feat: configurable label prefixes; /lifecycle /stage /status with Prow defaults; /help and /good-first-issue - #137
Merged
Conversation
Any top level key of .prowlabels.yaml is now a /<key> (and /remove-<key>)
label command once it is listed in prow-commands, so downstream repos can
add their own label families without code changes. A section is either a
plain list of values or a mapping { values: [...], exclusive: bool }; a
yaml `exclusive` wins over the registry default. The dispatcher resolves
/remove-<key> to /<key> for such names after the pinned alias table, and
the hand-written command switch becomes a lazily bound handler map so
those names are never treated as label commands.
The pr-labeler cron reads .github/labels.yaml, not .prowlabels.yaml, so its
test gets its own glob fixture instead of sharing the label one.
Signed-off-by: Jeffrey Sica <me@jeefy.dev>
Register the three Prow fixed-value label commands with their upstream values (frozen/stale/rotten, alpha/beta/stable, approved-for-milestone/in-progress/in-review). All are exclusive like the Prow plugins that remove sibling labels. A matching .prowlabels.yaml section replaces the built-in values, and its mapping form can turn the exclusive behaviour off. Signed-off-by: Jeffrey Sica <me@jeefy.dev>
Port Prow's help plugin. /help adds `help wanted`; /good-first-issue adds `good first issue` together with `help wanted`; /remove-help strips both and /remove-good-first-issue only `good first issue`. GitHub's default names contain spaces, so these commands are fixed and never read .prowlabels.yaml. Signed-off-by: Jeffrey Sica <me@jeefy.dev>
Prow compares labels without regard to case and GitHub label names are case-insensitive. `/kind Bug` now matches the allowlist value `bug` and applies the yaml's canonical casing; duplicate spellings collapse to one label. Labels already on the issue are compared the same way when an exclusive command picks siblings to replace or a /remove- form picks labels to delete, and the delete uses the issue's own casing. Signed-off-by: Jeffrey Sica <me@jeefy.dev>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Tier 2 of the Prow parity work. Finishes the
labelplugin and makes label prefixes configurable, so a repo like cncf/automation gets/status,/level,/triage,/tag,/sub… with zero code.feat(labels): configurable label sections with exclusive groups.prowlabels.yamlbecomes a/<key>command (plus/remove-<key>) when listed inprow-commands. Sections are either a plain list of values or a mapping:getLabelConfigloader normalizes both forms; malformed sections fail with a clear message.getArgumentLabelsremains as a thin wrapper (existing error strings preserved).^/[a-z][a-z0-9-]*$, not a known handler) → the old "could not execute" error for anything else./remove-<name>resolves to/<name>only for label commands —/remove-assigndoes not become/assign(pinned)./not-a-command, which is now a valid dynamic name; it uses/not_a_command, and the dashed case is pinned separately as a missing-yaml-key error.feat: /lifecycle, /stage and /status with Prow defaultsRegistry entries with Prow's fixed value sets —
frozen|stale|rotten,alpha|beta|stable,approved-for-milestone|in-progress|in-review— all mutually exclusive as in Prow. A yaml section with the same key overrides the defaults (so cncf/automation's different/statusvalues just work).feat: /help and /good-first-issueProw's help plugin, exactly:
/help→help wanted;/good-first-issue→good first issue+help wanted;/remove-helpremoves both;/remove-good-first-issueremoves onlygood first issue. Label names with spaces can't go through the arg-based engine, so these are fixed commands (no yaml involved — asserted no contents fetch).feat(labels): match allowlist values case-insensitively/kind Cleanup→kind/cleanup(allowlist casing wins), incl. exclusive-sibling and/remove-comparisons against labels already on the issue.Dogfood:
.prowlabels.yamlgains a mapping-formtriagesection;/lifecycle /help /triageadded to this repo'sprow-commands. Docs:labeling.mddocuments both forms,exclusive, defaults/overrides, and a cncf/automation-style example;commands.mdrows added.Testing
npm run allgreen at every commit — 33 files, 371 tests (was 322); coverage 90.3 / 90.7 br / 97.9 fndist/index.js:/level incubationwith mapping-form yaml (DELETE sibling + POST),/help(POST, no yaml GET)dist/byte-identical across repeated packsmainafter feat: Prow parity — case-insensitive commands, self-LGTM guard, author close/reopen/cancel, /close not-planned #136; no conflictsFollow-ups deliberately not in this PR
Tier 3/4 from the gap analysis:
approvedlabel + merge gate,do-not-merge/holdnaming option,@org/teamexpansion,/auto-cc, review-event lgtm.