feat: add support for stateReason in gh pr view (#9080)
This commit is contained in:
parent
7dc7b9838d
commit
140edf7327
1 changed files with 8 additions and 2 deletions
|
|
@ -268,6 +268,7 @@ var IssueFields = []string{
|
|||
"title",
|
||||
"updatedAt",
|
||||
"url",
|
||||
"stateReason",
|
||||
}
|
||||
|
||||
var PullRequestFields = append(IssueFields,
|
||||
|
|
@ -298,6 +299,12 @@ var PullRequestFields = append(IssueFields,
|
|||
"statusCheckRollup",
|
||||
)
|
||||
|
||||
// Some fields are only valid in the context of issues.
|
||||
var issueOnlyFields = []string{
|
||||
"isPinned",
|
||||
"stateReason",
|
||||
}
|
||||
|
||||
// IssueGraphQL constructs a GraphQL query fragment for a set of issue fields.
|
||||
func IssueGraphQL(fields []string) string {
|
||||
var q []string
|
||||
|
|
@ -363,10 +370,9 @@ func IssueGraphQL(fields []string) string {
|
|||
// PullRequestGraphQL constructs a GraphQL query fragment for a set of pull request fields.
|
||||
// It will try to sanitize the fields to just those available on pull request.
|
||||
func PullRequestGraphQL(fields []string) string {
|
||||
invalidFields := []string{"isPinned", "stateReason"}
|
||||
s := set.NewStringSet()
|
||||
s.AddValues(fields)
|
||||
s.RemoveValues(invalidFields)
|
||||
s.RemoveValues(issueOnlyFields)
|
||||
return IssueGraphQL(s.ToSlice())
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue