Skip to content

Add 'changed-files-limit' config to allow capping number of labels added#923

Open
bluca wants to merge 2 commits intoactions:mainfrom
bluca:label_limit
Open

Add 'changed-files-limit' config to allow capping number of labels added#923
bluca wants to merge 2 commits intoactions:mainfrom
bluca:label_limit

Conversation

@bluca
Copy link

@bluca bluca commented Feb 10, 2026

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:

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

Copilot AI review requested due to automatic review settings February 10, 2026 23:31
@bluca bluca requested a review from a team as a code owner February 10, 2026 23:31
@bluca
Copy link
Author

bluca commented Feb 10, 2026

Example of a PR where the labeling gets out of hands and spams the discussion page: systemd/systemd#40624

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-limit top-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
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants