我正在交叉发布来自here的问题。
我想知道是否可以使用GQL API获取给定引用的所有上下文的所有状态。
我目前正在执行的查询如下:
{
repository(owner: "owner", name: "name") {
pullRequests(headRefName: "head-ref", last: 1) {
nodes {
id
commits(first: 10) {
nodes {
commit {
oid
status {
contexts {
context
createdAt
id
description
state
}
}
}
}
}
}
}
}
}此查询为每个状态上下文返回单个状态,并且这些状态是每个状态上下文的最后一个状态:
{
"data": {
"repository": {
"pullRequests": {
"nodes": [
{
"id": "some-id",
"commits": {
"nodes": [
{
"commit": {
"oid": "some-oid",
"status": {
"contexts": [
{
"context": "context-1",
"createdAt": "2021-07-06T21:28:26Z",
"id": "***",
"description": "Your tests passed!",
"state": "SUCCESS"
},
{
"context": "context-2",
"createdAt": "2021-07-06T21:25:26Z",
"id": "***",
"description": "Your tests passed!",
"state": "SUCCESS"
},
]
}
}
}
]
}
}
]
}
}
}
}另一方面,如果我在此查询中使用REST API:
curl -i -u se7entyse7en:$(cat token) https://api.github.com/repos/owner/name/commits/some-oid/statuses其中,某些-oid是使用GQL API检索到的对应状态,输出包含所有状态。特别是,我可以看到在GQL API返回之前发生的context-1和context-2的所有状态。
鉴于StatusContext是一个节点而不是一个节点列表,这似乎是GQL模式的一个限制。基本上,我希望StatusContext的类型是Status!!其中Status表示给定上下文的单个状态。
我是不是漏掉了什么?这是预计在未来会改变的东西吗?REST API是唯一的选择吗?
谢谢。
发布于 2021-08-26 17:41:47
https://stackoverflow.com/questions/68803188
复制相似问题