api: serve gh pr over GraphQL and REST (#114) 288e98ea day ago 75 lines · 4.0 KB 1 [ 2 { 3 " command " : " gh pr status -R <host>/<login>/tools " , 4 " requests " : 5 { 6 " method " : 7 " path " : 8 " query " : 9 " headers " : 10 " accept " : 11 " content-type " : 12 " graphql-features " : 13 " x-github-api-version " : 14 } , 15 " body " : 16 " query " : 17 " variables " : 18 " headRefName " : 19 " number " : 20 " owner " : 21 " repo " : 22 " reviewerQuery " : 23 " viewerQuery " : 24 } 25 } , 26 " status " : 27 } , 28 { 29 " method " : 30 " path " : 31 " query " : 32 " headers " : 33 " accept " : 34 " content-type " : 35 " graphql-features " : 36 " x-github-api-version " : 37 } , 38 " body " : 39 " query " : 40 } , 41 " status " : 42 } , 43 { 44 " method " : 45 " path " : 46 " query " : 47 " headers " : 48 " accept " : 49 " content-type " : 50 " graphql-features " : 51 " x-github-api-version " : 52 } , 53 " body " : 54 " query " : 55 } , 56 " status " : 57 } , 58 { 59 " method " : 60 " path " : 61 " query " : 62 " headers " : 63 " accept " : 64 " content-type " : 65 " graphql-features " : 66 " x-github-api-version " : 67 } , 68 " body " : 69 " query " : 70 } , 71 " status " : 72 } 73 ] 74 } 75 ]
[
"
POST
"
,
"
/api/graphql
"
,
{}
,
{
"
application/json
"
,
"
application/json; charset=utf-8
"
,
"
merge_queue
"
,
"
2022-11-28
"
{
"
\n\t
fragment pr on PullRequest {number,title,state,url,isDraft,isCrossRepository,headRefName,headRepositoryOwner{id,login,...on User{name}},mergeStateStatus,baseRef{branchProtectionRule{requiresStrictStatusChecks}},autoMergeRequest {authorEmail,commitBody,commitHeadline,mergeMethod,enabledAt,enabledBy{login,...on User{id,name}}},statusCheckRollup: commits(last: 1) {nodes {commit {statusCheckRollup {contexts(first:100) {nodes {__typename...on StatusContext {context,state,targetUrl,createdAt,description},...on CheckRun {name,checkSuite{workflowRun{workflow{name}}},status,conclusion,startedAt,completedAt,detailsUrl}},pageInfo{hasNextPage,endCursor}}}}}}}
\n\t
fragment prWithReviews on PullRequest {...pr,reviewDecision,latestReviews(first: 100) {nodes {author{login},authorAssociation,submittedAt,body,state}}}
\n\t\n\t
query PullRequestStatus($owner: String!, $repo: String!, $headRefName: String!, $viewerQuery: String!, $reviewerQuery: String!, $per_page: Int = 10) {
\n\t\t
repository(owner: $owner, name: $repo) {
\n\t\t\t
defaultBranchRef {
\n\t\t\t\t
name
\n\t\t\t
}
\n\t\t\t
pullRequests(headRefName: $headRefName, first: $per_page, orderBy: { field: CREATED_AT, direction: DESC }) {
\n\t\t\t\t
totalCount
\n\t\t\t\t
edges {
\n\t\t\t\t\t
node {
\n\t\t\t\t\t\t
...prWithReviews
\n\t\t\t\t\t
}
\n\t\t\t\t
}
\n\t\t\t
}
\n\t\t
}
\n\t\n\t\t\t
viewerCreated: search(query: $viewerQuery, type: ISSUE, first: $per_page) {
\n\t\t\t\t
totalCount: issueCount
\n\t\t\t\t
edges {
\n\t\t\t\t\t
node {
\n\t\t\t\t\t
...prWithReviews
\n\t\t\t\t\t
}
\n\t\t\t\t
}
\n\t\t\t
}
\n\t\t\t
reviewRequested: search(query: $reviewerQuery, type: ISSUE, first: $per_page) {
\n\t\t\t\t
totalCount: issueCount
\n\t\t\t\t
edges {
\n\t\t\t\t\t
node {
\n\t\t\t\t\t
...pr
\n\t\t\t\t\t
}
\n\t\t\t\t
}
\n\t\t\t
}
\n\t\t
}
\n\t
"
,
{
""
,
0
,
"
<login>
"
,
"
tools
"
,
"
repo:<login>/tools state:open review-requested:<login>
"
,
"
repo:<login>/tools state:open is:pr author:<login>
"
200
"
POST
"
,
"
/api/graphql
"
,
{}
,
{
"
application/json
"
,
"
application/json
"
,
"
merge_queue
"
,
"
2022-11-28
"
{
"
query PullRequest_fields{PullRequest: __type(name:
\"
PullRequest
\"
){fields(includeDeprecated: true){name}},StatusCheckRollupContextConnection: __type(name:
\"
StatusCheckRollupContextConnection
\"
){fields(includeDeprecated: true){name}}}
"
200
"
POST
"
,
"
/api/graphql
"
,
{}
,
{
"
application/json
"
,
"
application/json
"
,
"
merge_queue
"
,
"
2022-11-28
"
{
"
query PullRequest_fields2{WorkflowRun: __type(name:
\"
WorkflowRun
\"
){fields(includeDeprecated: true){name}}}
"
200
"
POST
"
,
"
/api/graphql
"
,
{}
,
{
"
application/json
"
,
"
application/json
"
,
"
merge_queue
"
,
"
2022-11-28
"
{
"
query UserCurrent{viewer{login}}
"
200