Add new command issue pin#5597
Merged
Conversation
ffalor
commented
May 15, 2022
pkg/cmd/issue/shared/lookup.go
Outdated
Comment on lines
+75
to
+94
| // 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)) |
Contributor
Author
There was a problem hiding this comment.
lmk if there is a better way to do this. My graphql knowledge is limited.
Contributor
There was a problem hiding this comment.
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 😄
samcoe
approved these changes
Aug 31, 2022
Contributor
samcoe
left a comment
There was a problem hiding this comment.
@ffalor Apologies for taking so long to get around to this PR. The code looked great to me, but out of date so I pulled in the latest trunk. Also while looking over it I decided that having two commands pin and unpin was more desirable than pin --remove, so I pushed a change to implement that.
|
Lve demo here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5585
Adds the
issue pincommand to pin issues to a repositoryAdds the
--removeflag to remove pinned issues from a repository