From 1bab793c75175e50cc960cca5bc337cca06c03b1 Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Sat, 4 Jul 2026 22:45:34 +0100 Subject: [PATCH] CI: Fix deleting pr notifications after multiple reruns --- ci/ci-pages-notify.bash | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ci/ci-pages-notify.bash b/ci/ci-pages-notify.bash index e5dd599b6..67fa85dda 100755 --- a/ci/ci-pages-notify.bash +++ b/ci/ci-pages-notify.bash @@ -34,9 +34,14 @@ for RUN_ID in ${PR_RUN_IDS//,/ }; do cat ${ARTIFACTS_DIR}/body.txt gh pr comment $(cat ${ARTIFACTS_DIR}/pr-number.txt) --body-file ${ARTIFACTS_DIR}/body.txt - # Get the artifact ID - ARTIFACT_ID=$(gh api "repos/{owner}/{repo}/actions/runs/${RUN_ID}/artifacts" --jq '.artifacts[] | select(.name == "pr-notification") | .id') + # Get the artifact IDs. Note there can be more than one artifact named + # 'pr-notification' for a single run, as the artifacts endpoint lists + # artifacts across all run attempts, and a re-run uploads a new one while + # keeping the previous attempt's artifact. + ARTIFACT_IDS=$(gh api "repos/{owner}/{repo}/actions/runs/${RUN_ID}/artifacts" --jq '.artifacts[] | select(.name == "pr-notification") | .id') - # Delete it, so we only notify once - gh api --method DELETE "repos/{owner}/{repo}/actions/artifacts/${ARTIFACT_ID}" + # Delete them all, so we only notify once + for ARTIFACT_ID in ${ARTIFACT_IDS}; do + gh api --method DELETE "repos/{owner}/{repo}/actions/artifacts/${ARTIFACT_ID}" + done done