作者:如果阳光可以穿透心紧俏脏 | 来源:互联网 | 2022-12-13 20:23
使用GitHub GraphQL API(v.4),我想获取给定存储库中存在的所有分支名称。
我的尝试
{
repository(name: "my-repository", owner: "my-account") {
... on Ref {
name
}
}
}
返回错误:
{'data': None, 'errors': [{'message': "Fragment on Ref can't be spread inside Repository", 'locations': [{'line': 4, 'column': 13}]}]}
小智..
5
以下是从仓库中检索10个分支的方法:
{
repository(name: "git-point", owner: "gitpoint") {
refs(first: 10, , refPrefix:"refs/heads/") {
nodes {
name
}
}
}
}
PS:您通常在处理Union类型(例如,由不同类型的对象组成的IssueTimeline)时使用传播,因此您可以在特定的对象类型上传播以查询特定字段。
1> 小智..:
以下是从仓库中检索10个分支的方法:
{
repository(name: "git-point", owner: "gitpoint") {
refs(first: 10, , refPrefix:"refs/heads/") {
nodes {
name
}
}
}
}
PS:您通常在处理Union类型(例如,由不同类型的对象组成的IssueTimeline)时使用传播,因此您可以在特定的对象类型上传播以查询特定字段。