Skip to content

Commit 9720f8f

Browse files
committed
ci: Fix bench-thresholds-reset
1 parent b7692b3 commit 9720f8f

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

.github/workflows/bench-thresholds-reset.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,13 @@ jobs:
7070
case " $valid " in *" $w "*) ;; *) echo "skip unknown workload: $w"; continue ;; esac
7171
tag="baseline-reset-$w"
7272
echo "Anchoring $tag -> $sha"
73-
gh api -X PATCH "repos/$REPO/git/refs/tags/$tag" -f sha="$sha" -F force=true \
74-
|| gh api -X POST "repos/$REPO/git/refs" -f ref="refs/tags/$tag" -f sha="$sha"
73+
# Update the tag if it exists, else create it. (Checking first avoids
74+
# the spurious 422 a PATCH-then-POST logs on first creation.)
75+
if gh api --silent "repos/$REPO/git/refs/tags/$tag" 2>/dev/null; then
76+
gh api --silent -X PATCH "repos/$REPO/git/refs/tags/$tag" -f sha="$sha" -F force=true
77+
else
78+
gh api --silent -X POST "repos/$REPO/git/refs" -f ref="refs/tags/$tag" -f sha="$sha"
79+
fi
7580
done_list="$done_list $w"
7681
done
7782
[ -z "$done_list" ] && { echo "Nothing to reset."; exit 0; }

0 commit comments

Comments
 (0)