Repository navigation
Add support to manage issue/pull request/discussion locks #5020
Description
Activity
- addeddiscussFeature changes that require discussion primarily among the GitHub CLI teamFeature changes that require discussion primarily among the GitHub CLI teamand removedneeds-triageneeds to be reviewedneeds to be reviewed
on Jan 11, 2022 Note that you can currently lock/unlock issues via the
gh apicommand:gh api -X PUT repos/{owner}/{repo}/issues/123/lock -f lock_reason=resolved gh api -X DELETE repos/{owner}/{repo}/issues/123/lockWe could consider adding dedicated commands for this.
Reacted by Elan Ruusamäe- removeddiscussFeature changes that require discussion primarily among the GitHub CLI teamFeature changes that require discussion primarily among the GitHub CLI team
on Jan 19, 2022 - addedcoreThis issue is not accepting PRs from outside contributorsThis issue is not accepting PRs from outside contributors
on Jan 19, 2022 Let's do this, adding
unlockandlocktoissueandpr.For whoever picks this up: to reduce boilerplating and test effort, support for this should be contained in a single new command (which can lock/unlock both issues and prs) mounted at the four places it's needed via cobra.
If this is unclear, reach out to us for help.
Reacted by Elan RuusamäeReacted by Elan Ruusamäe- addedhelp wantedContributions welcomeContributions welcomeand removedcoreThis issue is not accepting PRs from outside contributorsThis issue is not accepting PRs from outside contributors
on Jan 19, 2022 I can take a look into this, if no one has started or claimed it.
After looking over the
issueandprcommands, I have a couple questions:- Conceptually, I understand that I should write a single function or command that gets aliased to
lockandunlock. Where should I put that single function? I see that there areshareddirectories in bothissueandpr. Should I be putting it one of thoseshareddirectories? - Are there similar commands that I can take a look at that do similar functionality and api requests? I just want to make sure I'm using the correct modules for authentication, api requests, etc.
- Conceptually, I understand that I should write a single function or command that gets aliased to
@chemotaxis You can start a
pkg/cmd/issue/lockpackage and have it export a method likeNewCmdLock(). The method could take an argument to either"lock"or"unlock"and return a*cobra.Command. With that, you can mount that Cobra command four times: toissue lock,issue unlock,pr lock, andpr unlock.Sure, you could also add that method to the
sharedpackage, but I think having an explicitlockpackage in accordance to the naming scheme of other command implementations will make it more discoverable.
Describe the feature or problem you’d like to solve
Proposed solution
Sometimes people continue the discussion on closed issues, so it's better to lock them as closed issues and pull requests are not visible for project maintainers.
Additional context
There are github actions, but doing this one time for bulk of issues is easier to do some cli scripting than setup github actions.