-
Notifications
You must be signed in to change notification settings - Fork 6k
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 flags to add additional metadata to issue/pr create
#787
Conversation
- `-a, --assignee` (accepts multiple) - `-l, --label` (accepts multiple) - `-p, --project` (accepts multiple) - `-m, --milestone`
- Includes support `pr create --reviewer <login>` - Hide "Preview in browser" menu option when any metadata are set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good, but I ran into problems running the commands. I get this error:
error fetching organization teams: Your token has not been granted the required scopes to execute this query. The 'id' field requires one of the following scopes: ['read:org', 'read:discussion'], but your token has only been granted the: ['repo'] scopes. Please modify your token's scopes at: https://github.com/settings/tokens.
I thought maybe I was using an old token or something, but I removed `.config/gh/config.yml and I had the same problems with the new token. Do we have to update the app permissions?
v4 := githubv4.NewClient(client.http) | ||
|
||
var projects []RepoProject | ||
for { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not used to golang's "while" loops
if err != nil { | ||
return nil, err | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it looks like the reviewQuery and the updateQuery are not dependent on each other, I was wondering if we could combine the queries and variables and just make one call to the server?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting suggestion! That should definitely be possible, even though we don't have a clean mechanism of merging GraphQL queries just yet. I will look into whether this is feasible
return len(vv) == 0 | ||
default: | ||
return true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very handy!
for _, assigneeLogin := range names { | ||
found := false | ||
for _, u := range m.AssignableUsers { | ||
if strings.EqualFold(assigneeLogin, u.Login) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL: case folding in go
Ignore my comment about app permissions. I saw |
This is completely understandable, and I should have stressed this out better. I wrote in the PR body: I've now merged master into this branch, so those manual steps are no longer necessary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great!
This matches `issue create` behavior 4b32e3f
Prompt for additional metadata during `issue/pr create`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great work!
Until we reach a consensus on how we want to interactively choose metadata during
issue/pr create
#768, this adds support for flags and introduces a rough mechanism for converting assignees/labels/projects/milestone names to their GraphQL ID.-r, --reviewer
(PRs only, accepts multiple)-a, --assignee
(accepts multiple)-l, --label
(accepts multiple)-p, --project
(accepts multiple)-m, --milestone
Example:
TODO:
pr create
-r, --reviewer
(accepts multiple) forpr create
-r, --reviewer
--label
wasn't set)Depends on #786
Ref. #340