Add new commands issue pin and issue unpin (#5597)
This commit is contained in:
parent
8cd9641284
commit
665e4e3446
11 changed files with 609 additions and 8 deletions
|
|
@ -3,6 +3,8 @@ package api
|
|||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/cli/cli/v2/pkg/set"
|
||||
)
|
||||
|
||||
func squeeze(r rune) rune {
|
||||
|
|
@ -208,9 +210,8 @@ var PullRequestFields = append(IssueFields,
|
|||
"statusCheckRollup",
|
||||
)
|
||||
|
||||
// PullRequestGraphQL constructs a GraphQL query fragment for a set of pull request fields. Since GitHub
|
||||
// pull requests are also technically issues, this function can be used to query issues as well.
|
||||
func PullRequestGraphQL(fields []string) string {
|
||||
// IssueGraphQL constructs a GraphQL query fragment for a set of issue fields.
|
||||
func IssueGraphQL(fields []string) string {
|
||||
var q []string
|
||||
for _, field := range fields {
|
||||
switch field {
|
||||
|
|
@ -265,6 +266,16 @@ func PullRequestGraphQL(fields []string) string {
|
|||
return strings.Join(q, ",")
|
||||
}
|
||||
|
||||
// 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"}
|
||||
s := set.NewStringSet()
|
||||
s.AddValues(fields)
|
||||
s.RemoveValues(invalidFields)
|
||||
return IssueGraphQL(s.ToSlice())
|
||||
}
|
||||
|
||||
var RepositoryFields = []string{
|
||||
"id",
|
||||
"name",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue