fix(ci): stop all-contributors bot from stripping contributions#381
Merged
Conversation
The pr-sort workflow ran an unconditional `all-contributors add <user> conference` before the jq guard meant to prevent re-adding an existing contribution type. all-contributors-cli replaces a contributor's entire contributions array when re-adding a type they already have, so the unconditional call collapsed contributors (e.g. JesperDramsch: 17 types -> ["conference"]) on every run. The guard then read the already-stripped file, found "conference" present, and skipped the second add — silently defeating the fix. Remove the unconditional add so the jq guard is the only add path: skip when the contributor already has "conference", add only for genuinely new contributors. Fixes the corruption behind the closed PRs #371 and #379.
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.
Problem
The
pr-sort.ymlworkflow has been opening PRs that strip existing contributors down to a singleconferencecontribution (e.g. @JesperDramsch went from 17 contribution types to just["conference"]in.all-contributorsrc,README.mdandCONTRIBUTING.md). This produced the bad PRs #371 and #379 (now closed).Root cause
The "Create branch and make changes" step ran an unconditional
all-contributors add <user> conferencebefore the jq guard that was added to prevent exactly this:all-contributors-clireplaces a contributor's entirecontributionsarray when re-adding a type they already have. So the unconditional call collapsed the array on every run; the guard then read the already-stripped file, sawconferencepresent, and skipped the second add — silently defeating the fix.Fix
Remove the unconditional add. The jq guard is now the only add path: it skips contributors who already have
conferenceand adds only genuinely new contributors. The guard logic itself was verified correct (jqindexreturns0/truthy for existing, exits non-zero for new).No behaviour change for new contributors; existing contributors are no longer corrupted.
Notes
workflow_dispatchmanual path (same code), so this one change covers both triggers.if:withgithub.event.pull_request.user.type == 'User'for a more robust bot check.