如何启用 GitHub 预览功能,例如主题?

How can I enable GitHub preview features, like topics?

我正在使用 Apps - listRepos 获取安装在我的 Probot GitHub 应用程序上的所有存储库的列表。

我希望响应数据包含每个存储库的 GitHub 主题 。目前只有 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

所以我想"provide a custom media type in the Accept header"。

有没有办法在 Probot 中启用 GitHub 预览功能?也许通过某种方式设置 RequestOptions

成功:我在 listRepos() 调用中添加了一个 headers 对象。

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.
);