Update labeler - #640
Open
mrbobbytables wants to merge 2 commits into
Open
Update labeler#640mrbobbytables wants to merge 2 commits into
mrbobbytables wants to merge 2 commits into
Conversation
Signed-off-by: Bob Killen <bkillen@linuxfoundation.org>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Command allowlist ambiguities can authorize malformed commands and remove valid labels before failing.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Updates the standalone Go labeler to improve matching, validation, error handling, and test coverage.
Changes:
- Adds typed command rules, strict configuration validation, and
**path matching. - Aggregates processing errors and paginates label cleanup.
- Expands tests and CI checks while aligning the Go version.
File summaries
| File | Description |
|---|---|
utilities/labeler/types.go |
Adds typed command constraints. |
utilities/labeler/README.md |
Documents command matching. |
utilities/labeler/main.go |
Corrects required argument count. |
utilities/labeler/labeler.go |
Revises matching, validation, and error handling. |
utilities/labeler/labeler_test.go |
Adds regression and configuration tests. |
utilities/labeler/Dockerfile |
Aligns the Go version. |
.github/workflows/labeler-build.yml |
Runs tests and vet in CI. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 4
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+208
to
+216
| values := append([]string(nil), rule.Spec.MatchList...) | ||
| for _, predicate := range rule.Spec.Rules { | ||
| values = append(values, predicate.Match) | ||
| values = append(values, predicate.MatchList...) | ||
| } | ||
| argument := "" | ||
| if len(argv) > 0 { | ||
| argument = argv[0] | ||
| } |
Comment on lines
+217
to
+221
| if slices.Contains(values, argument) { | ||
| return true | ||
| } | ||
| for _, action := range rule.Actions { | ||
| if action.Kind == "apply-label" && slices.Contains(values, l.renderLabel(action.Spec.Label, argv)) { |
Comment on lines
+649
to
+650
| for _, rule := range cfg.Ruleset { | ||
| switch rule.Kind { |
Comment on lines
+892
to
+893
| func TestLoadProductionConfig(t *testing.T) { | ||
| configFile, err := os.Open("../../.github/labels.yaml") |
… validation - Reject missing arguments when match rules specify an allowlist - Separate raw-argument constraints from rendered-label constraints in commandAllowed - Preflight rendered actions before performing any label removals - Validate matchCondition enum strictly during config loading - Watch .github/labels.yaml in labeler build CI workflow Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Bob Killen <bkillen@linuxfoundation.org>
Member
Author
|
Addressed the review feedback:
🐝 Hive Agent: |
Member
Author
|
Addressed review comments in 3a0ebed:
🐝 Hive Agent: |
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.
Fixes a few error conditions
Enables use of **
Adds more thorough test conditions