如何查询repo_id和category_id

moyigeek Lv3

如何查询repo_id和category_id

在配置基于 Github Discussions的博客评论系统时(例如aiscus),往往需要获取repo的repoId、cateqoryId 等属性,因此这里介绍一种获
这些信息的方法。

首先需要开启仓库的 Discussions 功能。在仓库的 Settings -> Options -> Features 中找到 Discussions 并开启。

访问Github Docs Explorer , 在左侧的文本框中输入以下代码:

记得修改userName和repoName为你的用户名和仓库名。

1
2
3
4
5
6
7
8
9
10
11
{
repository(owner: "userName", name: "repoName") {
id
discussionCategories (first: 5) {
nodes {
name
id
}
}
}
}

即可在右侧看到返回的数据,其中id即为repo_iddiscussionCategories中的id即为category_id

  • Title: 如何查询repo_id和category_id
  • Author: moyigeek
  • Created at : 2024-11-25 13:55:30
  • Updated at : 2025-12-11 11:16:47
  • Link: https://blog.moyihust.eu.org/2024/11/25/如何查询repo-id和category-id/
  • License: This work is licensed under CC BY-NC-SA 4.0.
Comments
On this page
如何查询repo_id和category_id