ezyang / ghstack

Submit stacked diffs to GitHub on the command line

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add command line option to specify labels

SplitInfinity opened this issue · comments

Consider adding a command line option (e.g. --labels=...) that would allow users to specify labels that should be applied to the PR when it is created. Without this, users have to open the PR and add the label(s) manually or use the GitHub command line tool after running ghstack.

I'm 90% sure the GitHub API supports adding labels to PRs (either at creation time or after), so I think it's matter of adding the option and plumbing the value provided by the user through to the API call.

I couldn't find anything about labels in the API docs for creating a PR, so I did some quick Googling and found octokit/octokit.net#1862, which seems to imply that, while you can use the API to add a label right after the PR is created, there isn't a way to add the label while creating it. I could be mistaken though, since that issue is a few years old and also on a .NET-specific repo.

Would this still fit your use case? It would require another network round-trip but that's probably fine; I guess the question is whether this label application would happen before or after pytorch-probot queries for labels.

Also, should the labels given on the command line be applied to all PRs in the stack even if they already exist, or only newly created PRs?

I couldn't find anything about labels in the API docs for creating a PR, so I did some quick Googling and found octokit/octokit.net#1862, which seems to imply that, while you can use the API to add a label right after the PR is created, there isn't a way to add the label while creating it. I could be mistaken though, since that issue is a few years old and also on a .NET-specific repo.

Would this still fit your use case? It would require another network round-trip but that's probably fine; I guess the question is whether this label application would happen before or after pytorch-probot queries for labels.

My use case is applying labels to my PRs so that the right tests run on them in the pytorch/pytorch repo.

Also, should the labels given on the command line be applied to all PRs in the stack even if they already exist, or only newly created PRs?

I think a --all option might be useful here to distinguish between the two.