You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add support to manage issue/pull request/discussion locks #5020
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.
Let's do this, adding unlock and lock to issue and pr.
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.
After looking over the issue and pr commands, I have a couple questions:
Conceptually, I understand that I should write a single function or command that gets aliased to lock and unlock. Where should I put that single function? I see that there are shared directories in both issue and pr. Should I be putting it one of those shared directories?
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.
@chemotaxis You can start a pkg/cmd/issue/lock package and have it export a method like NewCmdLock(). 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: to issue lock, issue unlock, pr lock, and pr unlock.
Sure, you could also add that method to the shared package, but I think having an explicit lock package in accordance to the naming scheme of other command implementations will make it more discoverable.
Activity
mislav commentedon Jan 11, 2022
Note that you can currently lock/unlock issues via the
gh apicommand:We could consider adding dedicated commands for this.
vilmibm commentedon 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.
chemotaxis commentedon Jan 23, 2022
I can take a look into this, if no one has started or claimed it.
chemotaxis commentedon Jan 25, 2022
@vilmibm
After looking over the
issueandprcommands, I have a couple questions:lockandunlock. Where should I put that single function? I see that there areshareddirectories in bothissueandpr. Should I be putting it one of thoseshareddirectories?mislav commentedon Feb 1, 2022
@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.