GitHub GraphQL:获取特定存储库的所有分支
我想得到一个特定存储库的所有分支的列表 当我试着穿上下面的衣服时 它正确返回fork计数,但在节点内部,名称只是原始的repo名称。但我想让它给出所有分叉存储库的名称GitHub GraphQL:获取特定存储库的所有分支,github,graphql,fork,Github,Graphql,Fork,我想得到一个特定存储库的所有分支的列表 当我试着穿上下面的衣服时 它正确返回fork计数,但在节点内部,名称只是原始的repo名称。但我想让它给出所有分叉存储库的名称 { "data": { "repository": { "name": "specificRepo", "forkCount": 12, "forks": { "totalCount": 1, "nodes": [ {
{
"data": {
"repository": {
"name": "specificRepo",
"forkCount": 12,
"forks": {
"totalCount": 1,
"nodes": [
{
"name": "specificRepo",
}
]
}
}
}
}
如果您进行回购,然后更改名称,
name
字段将反映更改后的名称,而不是原始名称。例如,这里有一个语义UI
:
{
repository(
owner: "Semantic-Org"
name: "Semantic-Ui"
) {
name
forkCount
forks(
first: 12
orderBy: { field: NAME, direction: DESC }
) {
totalCount
nodes {
name
}
}
}
}
你的名字是什么意思?存储库名称不变,是
nameWithOwner
您在寻找什么?fork的名称如果有人提出回购协议,然后更改其fork的名称嗯-因为这是一个github graphql问题,你能提供graph ql解决方案吗?@maddie更新了答案,并举例说明我正在寻找的解决方案将回答文章的标题,即如何获取特定存储库的所有分支。您知道如何更改我的查询,以便我可以列出存储库的所有分叉(访问分叉的名称和分叉的所有者)。我可以使用curl命令来实现这一点:curl-GEThttps://api.github.com/repos/:owner/:repo/forks
如果你问如何绕过限制,你不能。一次只能获取100个节点。因此,除了必须对结果进行分页外,您的原始查询是可以的。但是我的原始查询没有得到叉的名称,它只返回原始存储库的名称-我希望看到所有12个叉的名称。这对于已更改为不同于原始回购协议名称的分叉非常有用
{
repository(
owner: "Semantic-Org"
name: "Semantic-Ui"
) {
name
forkCount
forks(
first: 12
orderBy: { field: NAME, direction: DESC }
) {
totalCount
nodes {
name
}
}
}
}
{
"data": {
"repository": {
"name": "Semantic-UI",
"forkCount": 4936,
"forks": {
"totalCount": 4743,
"nodes": [
{
"name": "WEB_JS_GUI-Semantic-UI"
},
{
"name": "Vanz-Sing-In"
},
{
"name": "Somewhat-Semantic-UI"
},
{
"name": "semantic_1.0_experiment"
},
{
"name": "semanticui"
},
{
"name": "semantic.ui_main"
},
{
"name": "Semantic-UI-V2"
},
{
"name": "Semantic-UI-tr"
},
{
"name": "Semantic-UI-tr"
},
{
"name": "Semantic-UI-Stylus"
},
{
"name": "Semantic-UI-pt-br"
},
{
"name": "Semantic-UI-pp"
}
]
}
}
}
}