mlevkov opened a new pull request, #4060:
URL: https://github.com/apache/iggy/pull/4060

   Implements @hubcio's follow-up from 
[#3982](https://github.com/apache/iggy/issues/3982#issuecomment-5546627600): a 
`/pin` command alongside `/ready` and `/author`, usable by the author or a 
maintainer.
   
   Kept separate from #4059 because that one is docs-only and this touches 
`pr-triage-apply.yml`.
   
   ### The label does not exist
   
   `stale-prs.yml` has `exempt-pr-labels: "pinned"` and nothing else, but 
**`pinned` is not one of the repo's 47 labels**. So today the only exemption 
from the 14-day auto-close names a label nothing can carry, and there was no 
way to ask for it either. A PR sitting in `S-waiting-on-review` gets closed on 
day 14 the same as one nobody is working on.
   
   So `ensurePinnedLabel()` creates the label on first use instead of assuming 
it exists. I could not find the behaviour documented either way for whether the 
labels API materializes an unknown name, so this does not depend on it. The job 
already holds `issues: write`.
   
   If you would rather create `pinned` by hand in repo settings and have the 
workflow assume it, say so and I will drop that helper.
   
   ### What it does
   
   | Command | Who | Effect |
   | --- | --- | --- |
   | `/pin` | author or maintainer | add `pinned` |
   | `/unpin` | author or maintainer | remove `pinned` |
   
   Same gate as `/ready` and `/request-review` (`isCommitter || isPrAuthor`), 
which matches "author or maintainers" from your comment. It deliberately does 
not use the wider `/author` gate: pinning is reversible and visible as a label.
   
   `pinned` is orthogonal to the mutually-exclusive `S-*` pair, so it uses 
`addLabels`/`removeLabel` directly rather than `replaceStateLabel`, and never 
enters that helper's list-then-PUT window. `/unpin` treats a 404 as success, 
since "not labeled" and "label absent" both mean the PR is already where 
`/unpin` wants it.
   
   ### Two things worth your call
   
   1. **`/unpin` was not in your comment.** I added it because otherwise only 
someone with triage rights can undo a pin, which makes it a one-way door for a 
contributor. Happy to drop it.
   2. **An author can exempt their own PR indefinitely.** That follows from 
"author or maintainers", but it does mean the stale bot can be opted out of 
unilaterally. If you would rather `/pin` be committer-only, or have `/unpin` 
stay open while `/pin` narrows, that is a one-line change.
   
   ### Checks
   
   `COMMAND_RE` is a gate that returns early when no command matches, so 
`pin|unpin` had to be added there as well as in the dispatch loop. Verified the 
regexes against the suffix-prose case the existing comment warns about:
   
   ```
   /pin            gate=true   pin=true  unpin=false
   /unpin          gate=true   pin=false unpin=true
   /pinned         gate=false  pin=false unpin=false
   /pin-it         gate=false  pin=false unpin=false
   please /pin it  gate=false  pin=false unpin=false
   ```
   
   The embedded script passes `node --check`, and `markdownlint` passes on 
`CONTRIBUTING.md`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to