Repository navigation
fix: leave excluded labels out of dry-run deletions - #1105
Open
TovaBecker wants to merge 1 commit into
Open
TovaBecker wants to merge 1 commit into
TovaBecker wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused implementation matches the intended behavior and is adequately covered by tests.
0 open findings
What changed in this PR
Filters excluded labels from dry-run comparisons while retaining managed labels for updates and renames.
Changes:
- Excludes unmanaged protected labels from comparison results.
- Adds dry-run coverage for exclusion, update, rename, and creation behavior.
| File | Description |
|---|---|
lib/plugins/labels.js |
Filters unmanaged excluded labels during discovery. |
test/unit/lib/plugins/labels.test.js |
Verifies corrected dry-run behavior. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This branch has not been deployed
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 #764
Why
Labels matching
labels.excludeare never deleted, but the dry-run PR comment still lists every one of them under deletions. With a broad pattern such asexclude: [{ name: '.*' }](keep all existing labels, add a few managed ones), every existing label in every repo shows up as a deletion, including itsid,node_id, andurl.In one organization with 51 repos, this filled the comment to the 55,536-character limit after 8 repos. About 93% of the comment was these phantom deletions, and the real changes for the remaining repos were cut off.
The cause:
Labels.remove()skips excluded labels, but the summary is built bycompareDeepinDiffable.sync(), which compares all existing labels with the config and doesn't know aboutexclude.Approach
Labels.find(), so they never enter the comparison, the summary, orremove().nameoroldname), so they can still be updated or renamed.Validation
test/unit/lib/plugins/labels.test.js: an excluded label doesn't appear in the dry-run results (fails without the fix), and excluded labels that the config manages are still updated, renamed, and created.