From 4d2fb880605fb2f1215067eb78564debbdf7ff1b Mon Sep 17 00:00:00 2001 From: Jesper Dramsch Date: Sat, 27 Jun 2026 22:51:59 +0200 Subject: [PATCH] fix(ci): stop all-contributors bot from stripping contributions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The pr-sort workflow ran an unconditional `all-contributors add 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. --- .github/workflows/pr-sort.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-sort.yml b/.github/workflows/pr-sort.yml index f13b495d13..b90160c933 100644 --- a/.github/workflows/pr-sort.yml +++ b/.github/workflows/pr-sort.yml @@ -84,10 +84,12 @@ jobs: # This check avoids a bug in all-contributors-cli (issue #371) where # adding an existing contribution type replaces all existing contributions if [[ -n "${{ steps.vars.outputs.contributor }}" ]]; then - pixi run install - pixi run add ${{ steps.vars.outputs.contributor }} conference CONTRIBUTOR="${{ steps.vars.outputs.contributor }}" - # Check if contributor already has "conference" contribution (the overlap triggers the bug) + # Check if contributor already has "conference" contribution (the overlap triggers the bug). + # IMPORTANT: there must be NO unconditional `all-contributors add` before this guard. + # all-contributors-cli replaces a contributor's whole contributions array when re-adding an + # existing type, so re-adding "conference" to someone who already has it strips their other + # contributions. The guard below is the ONLY add path: skip when "conference" is already present. if ! jq -e --arg login "$CONTRIBUTOR" '.contributors[] | select(.login == $login) | .contributions | index("conference")' .all-contributorsrc > /dev/null 2>&1; then echo "Adding conference contribution for: $CONTRIBUTOR" pixi run install