Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new command issue pin #5597

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Open

Add new command issue pin #5597

wants to merge 3 commits into from

Conversation

ffalor
Copy link
Contributor

@ffalor ffalor commented May 10, 2022

Fixes #5585

Adds the issue pin command to pin issues to a repository
Adds the --remove flag to remove pinned issues from a repository

image

@ffalor ffalor marked this pull request as ready for review May 15, 2022
@ffalor ffalor requested a review from as a code owner May 15, 2022
@ffalor ffalor requested review from mislav (assigned from cli/code-reviewers) and removed request for May 15, 2022
@cliAutomation cliAutomation added the external label May 15, 2022
@cliAutomation cliAutomation added this to Needs review 🤔 in The GitHub CLI May 15, 2022
// isPinned is an invalid field for PullRequest
prFields := make([]string, len(fields))
for i, f := range fields {
if f == "isPinned" {
prFields = append(fields[:i], fields[i+1:]...)
break
}
}

query := fmt.Sprintf(`
query IssueByNumber($owner: String!, $repo: String!, $number: Int!) {
repository(owner: $owner, name: $repo) {
hasIssuesEnabled
issue: issueOrPullRequest(number: $number) {
__typename
...on Issue{%[1]s}
...on PullRequest{%[1]s}
...on PullRequest{%[2]s}
}
}
}`, api.PullRequestGraphQL(fields))
}`, api.PullRequestGraphQL(fields), api.PullRequestGraphQL(prFields))
Copy link
Contributor Author

@ffalor ffalor May 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lmk if there is a better way to do this. My graphql knowledge is limited.

Copy link
Contributor

@rsteube rsteube May 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

repository has pinnedIssues (see here).
Might potentially give better performance but could also opt for this solution for consistency.
edit: ah forget it, you aren't listing them but rather looking up by number 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external
Projects
The GitHub CLI
  
Needs review 🤔
Development

Successfully merging this pull request may close these issues.

4 participants