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
probablycorey
left a comment
There was a problem hiding this comment.
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.
I'm still not used to golang's "while" loops
| if err != nil { | ||
| return nil, err | ||
| } | ||
| } |
There was a problem hiding this comment.
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.
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 | ||
| } |
| for _, assigneeLogin := range names { | ||
| found := false | ||
| for _, u := range m.AssignableUsers { | ||
| if strings.EqualFold(assigneeLogin, u.Login) { |
There was a problem hiding this comment.
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. |
This matches `issue create` behavior 4b32e3f
Prompt for additional metadata during `issue/pr create`
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, --milestoneExample:
TODO:
pr create-r, --reviewer(accepts multiple) forpr create-r, --reviewer--labelwasn't set)Depends on #786
Ref. #340