Skip to content

Commit d33dd22

Browse files
fix(ci): stop all-contributors bot from stripping contributions (#381)
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.
1 parent 012c7f4 commit d33dd22

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

.github/workflows/pr-sort.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,12 @@ jobs:
8484
# This check avoids a bug in all-contributors-cli (issue #371) where
8585
# adding an existing contribution type replaces all existing contributions
8686
if [[ -n "${{ steps.vars.outputs.contributor }}" ]]; then
87-
pixi run install
88-
pixi run add ${{ steps.vars.outputs.contributor }} conference
8987
CONTRIBUTOR="${{ steps.vars.outputs.contributor }}"
90-
# Check if contributor already has "conference" contribution (the overlap triggers the bug)
88+
# Check if contributor already has "conference" contribution (the overlap triggers the bug).
89+
# IMPORTANT: there must be NO unconditional `all-contributors add` before this guard.
90+
# all-contributors-cli replaces a contributor's whole contributions array when re-adding an
91+
# existing type, so re-adding "conference" to someone who already has it strips their other
92+
# contributions. The guard below is the ONLY add path: skip when "conference" is already present.
9193
if ! jq -e --arg login "$CONTRIBUTOR" '.contributors[] | select(.login == $login) | .contributions | index("conference")' .all-contributorsrc > /dev/null 2>&1; then
9294
echo "Adding conference contribution for: $CONTRIBUTOR"
9395
pixi run install

0 commit comments

Comments
 (0)