Add 'changed-files-limit' config to allow capping number of labels added#923
Add 'changed-files-limit' config to allow capping number of labels added#923bluca wants to merge 2 commits intoactions:mainfrom
Conversation
|
Example of a PR where the labeling gets out of hands and spams the discussion page: systemd/systemd#40624 |
There was a problem hiding this comment.
Pull request overview
This PR adds a changed-files-limit configuration option to the labeler action to prevent label spam when large refactors touch many components. When the number of new changed-files labels exceeds the configured limit, all new changed-files labels are skipped, while branch-based labels and preexisting labels remain unaffected.
Changes:
- Added
changed-files-limittop-level configuration option to cap the number of changed-files labels - Implemented logic to track and differentiate between changed-files labels and branch-based labels
- Added comprehensive test coverage with 8 new test cases covering various limit scenarios
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/labeler.ts | Implements limit checking logic that tracks changed-files labels and removes them if the limit is exceeded |
| src/api/get-label-configs.ts | Adds parsing and validation for the new changed-files-limit config option and a helper function to identify changed-files labels |
| dist/index.js | Compiled JavaScript output reflecting the TypeScript changes |
| tests/main.test.ts | Adds 8 integration test cases covering various limit scenarios including edge cases with preexisting labels |
| tests/labeler.test.ts | Adds unit tests for the new parsing logic and configUsesChangedFiles helper function |
| tests/fixtures/*.yml | Four new YAML test fixtures with different limit configurations |
| README.md | Comprehensive documentation of the new feature with examples and usage guidance |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
When a repository has many components, each with a changed-files label, a large refactor ends up with the labeler spamming the pull request with label changes. The end result is not very useful as it's not very readable, and due to how github automatically hides comments when label changes overflow the discussion tab, it means useful information is hidden and one has to manually click "Load more..." dozens of time every time the page is loaded. Add a changed-files-limit top level config knob. If more than the configured limit of labels is set to be added, none are added. This only affects changed-files labels. Fixes actions#486
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 11 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description:
When a repository has many components, each with a changed-files label, a large refactor ends up with the labeler spamming the pull request with label changes. The end result is not very useful as it's not very readable, and due to how github automatically hides comments when label changes overflow the discussion tab, it means useful information is hidden and one has to manually click "Load more..." dozens of time every time the page is loaded.
Add a changed-files-limit top level config knob. If more than the configured limit of labels is set to be added, none are added. This only affects changed-files labels.
Check list: