GitHub GraphQL:获取特定存储库的所有分支
GitHub GraphQL: Get all forks of specific repository
我想获取特定存储库的所有复刻列表。
当我在 explorer
上尝试以下操作时
repository( owner: "someOrg", name: "specificRepo"){
name
forkCount
forks(first: 12){
totalCount
nodes{
name
}
}
}
}
它 returns 分叉计数正确,但在节点内部,名称只是原始回购名称。但我希望它给出所有分叉存储库的名称。
{
"data": {
"repository": {
"name": "specificRepo",
"forkCount": 12,
"forks": {
"totalCount": 1,
"nodes": [
{
"name": "specificRepo",
}
]
}
}
}
}
如果你 fork 一个 repo 然后更改名称,name
字段将反映更改后的名称,而不是原始名称。例如,这是 Semantic-UI
的一个分支:
{
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"
}
]
}
}
}
}
现在您也可以请求添加 nameWithOwner
字段,甚至 url
。这将为您提供所需的信息。
{
repository(
owner: "Semantic-Org"
name: "Semantic-Ui"
) {
name
forkCount
forks(
first: 12
orderBy: { field: NAME, direction: DESC }
) {
totalCount
nodes {
name
nameWithOwner
url
}
}
}
}
哪个会给你:
{
"data": {
"repository": {
"name": "Semantic-UI",
"forkCount": 5133,
"forks": {
"totalCount": 4919,
"nodes": [
{
"name": "Vanz-Sing-In",
"nameWithOwner": "semantic-apps/Vanz-Sing-In",
"url": "https://github.com/semantic-apps/Vanz-Sing-In"
},
etc.
}
}
}
}
我想获取特定存储库的所有复刻列表。
当我在 explorer
上尝试以下操作时 repository( owner: "someOrg", name: "specificRepo"){
name
forkCount
forks(first: 12){
totalCount
nodes{
name
}
}
}
}
它 returns 分叉计数正确,但在节点内部,名称只是原始回购名称。但我希望它给出所有分叉存储库的名称。
{
"data": {
"repository": {
"name": "specificRepo",
"forkCount": 12,
"forks": {
"totalCount": 1,
"nodes": [
{
"name": "specificRepo",
}
]
}
}
}
}
如果你 fork 一个 repo 然后更改名称,name
字段将反映更改后的名称,而不是原始名称。例如,这是 Semantic-UI
的一个分支:
{
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"
}
]
}
}
}
}
现在您也可以请求添加 nameWithOwner
字段,甚至 url
。这将为您提供所需的信息。
{
repository(
owner: "Semantic-Org"
name: "Semantic-Ui"
) {
name
forkCount
forks(
first: 12
orderBy: { field: NAME, direction: DESC }
) {
totalCount
nodes {
name
nameWithOwner
url
}
}
}
}
哪个会给你:
{
"data": {
"repository": {
"name": "Semantic-UI",
"forkCount": 5133,
"forks": {
"totalCount": 4919,
"nodes": [
{
"name": "Vanz-Sing-In",
"nameWithOwner": "semantic-apps/Vanz-Sing-In",
"url": "https://github.com/semantic-apps/Vanz-Sing-In"
},
etc.
}
}
}
}