Fix showing Checks in pr status
This was a regression in how `statusCheckRollup` is queried and stored. As a result, `gh pr status` did not include rendered information about checks related to each pull request. This switches the query builder to `PullRequestGraphQL()` to eliminate the outdated query.
This commit is contained in:
parent
75abeb13a8
commit
f5cd33b4bf
1 changed files with 10 additions and 54 deletions
|
|
@ -531,67 +531,23 @@ func pullRequestFragment(httpClient *http.Client, hostname string) (string, erro
|
|||
return "", err
|
||||
}
|
||||
|
||||
var reviewsFragment string
|
||||
if prFeatures.HasReviewDecision {
|
||||
reviewsFragment = "reviewDecision"
|
||||
fields := []string{
|
||||
"number", "title", "state", "url", "isDraft", "isCrossRepository",
|
||||
"headRefName", "headRepositoryOwner", "mergeStateStatus",
|
||||
}
|
||||
|
||||
var statusesFragment string
|
||||
if prFeatures.HasStatusCheckRollup {
|
||||
statusesFragment = `
|
||||
commits(last: 1) {
|
||||
nodes {
|
||||
commit {
|
||||
statusCheckRollup {
|
||||
contexts(last: 100) {
|
||||
nodes {
|
||||
...on StatusContext {
|
||||
state
|
||||
}
|
||||
...on CheckRun {
|
||||
conclusion
|
||||
status
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
fields = append(fields, "statusCheckRollup")
|
||||
}
|
||||
|
||||
var requiresStrictStatusChecks string
|
||||
if prFeatures.HasBranchProtectionRule {
|
||||
requiresStrictStatusChecks = `
|
||||
baseRef {
|
||||
branchProtectionRule {
|
||||
requiresStrictStatusChecks
|
||||
}
|
||||
}`
|
||||
var reviewFields []string
|
||||
if prFeatures.HasReviewDecision {
|
||||
reviewFields = append(reviewFields, "reviewDecision")
|
||||
}
|
||||
|
||||
fragments := fmt.Sprintf(`
|
||||
fragment pr on PullRequest {
|
||||
number
|
||||
title
|
||||
state
|
||||
url
|
||||
headRefName
|
||||
mergeStateStatus
|
||||
headRepositoryOwner {
|
||||
login
|
||||
}
|
||||
%s
|
||||
isCrossRepository
|
||||
isDraft
|
||||
%s
|
||||
}
|
||||
fragment prWithReviews on PullRequest {
|
||||
...pr
|
||||
%s
|
||||
}
|
||||
`, requiresStrictStatusChecks, statusesFragment, reviewsFragment)
|
||||
fragment pr on PullRequest {%s}
|
||||
fragment prWithReviews on PullRequest {...pr,%s}
|
||||
`, PullRequestGraphQL(fields), PullRequestGraphQL(reviewFields))
|
||||
return fragments, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue