简体   繁体   中英

How can I enable GitHub preview features, like topics?

I'm using Apps - listRepos to get a list of all the repositories installed on my Probot GitHub application.

I want the response data to include the GitHub topics for each repository. This is currently only available as a preview feature :

The topics property for repositories on GitHub is currently available for developers to preview. To view the topics property in calls that return repository results, you must provide a custom media type in the Accept header:

application/vnd.github.mercy-preview+json

So I think I want to "provide a custom media type in the Accept header".

Is there a way to enable GitHub preview features in Probot? Perhaps by somehow setting RequestOptions ?

Success: I added a headers object to my listRepos() call.

 const repositories = await octokit.paginate( octokit.apps.listRepos({ per_page: 100, headers: { accept: 'application/vnd.github.machine-man-preview+json,application/vnd.github.mercy-preview+json' } }), res => res.data.repositories // Pull out only the list of repositories from each response. ); 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM