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
PR labelling fails with Not Found, and the workflow token lacks permission to add labels. Replace the old prefix action with actions/github-script@v9 and grant only pull-requests: write.
The workflow keeps the 13 existing prefix mappings and additive labels. It reads the title as data and runs no PR checkout or code.
After: all 33 script probes pass, covering every prefix, unmatched and code-like titles, and API failure propagation. Actionlint, whitespace and all five pre-commit hooks pass.
All eight hosted build, test, performance and pre-commit jobs pass on head 1cf11133a1f610519a1684049620121f39119d18.
All 13 destination labels exist in the fork and were read back after provisioning.
Review confirmed that delimiter-free matching preserves the old action's behaviour: index.js:50 also uses title.startsWith(key). This repair retains that contract, including BUGFIX matching BUG. Requiring a colon would be a separate behaviour change.
Merge danger
Door: two-way. Blast radius: PR labels.
pull_request_target runs the workflow from the base branch. The installation PR therefore still uses the old job. Any exception must cover only that installation; subsequent PRs must pass the replacement job.
The action retains the repository's major-version pinning convention. The reference is mutable.
Unverified
The old base-branch labeler fails on this installation PR. After installation, verify a recognised prefix, an unmatched title and preservation of existing labels. All other hosted checks pass.
Restore PR prefix labelling with scoped permissions
🐞 Bug fix⚙️ Configuration changes🕐 10-20 Minutes
AI Description
• Replace the failing prefix action with GitHub Script while preserving all 13 title mappings and
additive labels.
• Grant the labeler job only pull-request write permission so it can apply labels.
The following are alternative approaches to this PR:
1. Retain the third-party prefix action
➕ Smaller workflow change; retains the existing integration.
➖ Continues running a third-party action with a write-capable token under pull_request_target.
➖ Does not address the reported action failure on its own.
Recommendation: Use the proposed GitHub Script approach: the matching logic is small enough to keep in the workflow, and it avoids a third-party action in a privileged job. After merge, verify labelling on a new PR because pull_request_target uses the base-branch workflow.
Files changed (1) +20 / -3
Bug fix (1) +20 / -3
labeler.ymlReplace the failing labeler and scope its token+20/-3
Replace the failing labeler and scope its token
• Replaces the prefix-labeler action with GitHub Script, retaining all 13 starts-with mappings and adding only the matched label. Grants the job pull-request write permission; unmatched titles make no API call.
1. Unrelated PR titles get mislabeled 🟠 P1🐞 Bug≡ Correctness
Description
The title.startsWith(key) check accepts a mapped key at the start of a longer word without
checking where the prefix ends. A title such as BUGFIX: improve parsing therefore receives the
bug label, which is also a release-drafter category, despite not using the BUG: prefix.
The workflow selects a key using only startsWith and passes its mapped value to addLabels; the
release-drafter configuration categorizes pull requests bearing that label. The former action's
documented prefix examples use a colon after each key, including BUG:.
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
## Issue description
Prefix matching accepts longer words such as `BUGFIX:` as `BUG` and adds an unintended label.
## Fix Focus Areas
- .github/workflows/labeler.yml[22-25]
## Recommended Fix
Match a configured prefix only when followed by the intended delimiter, such as `:`, and add a probe confirming `BUGFIX:` remains unmatched.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR labelling fails with
Not Found, and the workflow token lacks permission to add labels. Replace the old prefix action withactions/github-script@v9and grant onlypull-requests: write.The workflow keeps the 13 existing prefix mappings and additive labels. It reads the title as data and runs no PR checkout or code.
Evidence
1cf11133a1f610519a1684049620121f39119d18.Review confirmed that delimiter-free matching preserves the old action's behaviour:
index.js:50also usestitle.startsWith(key). This repair retains that contract, includingBUGFIXmatchingBUG. Requiring a colon would be a separate behaviour change.Merge danger
Door: two-way. Blast radius: PR labels.
pull_request_targetruns the workflow from the base branch. The installation PR therefore still uses the old job. Any exception must cover only that installation; subsequent PRs must pass the replacement job.The action retains the repository's major-version pinning convention. The reference is mutable.
Unverified
The old base-branch labeler fails on this installation PR. After installation, verify a recognised prefix, an unmatched title and preservation of existing labels. All other hosted checks pass.