File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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; }
You can’t perform that action at this time.
0 commit comments