override tag is SHAs don't match

This commit is contained in:
benniekiss 2024-11-10 11:20:37 -05:00
parent c8da55adba
commit ec4a3e9cf2

View file

@ -32,10 +32,15 @@ ensure_tag() {
if api GET repos/$REPO/tags/$TAG > $TMP_DIR/tag.json ; then if api GET repos/$REPO/tags/$TAG > $TMP_DIR/tag.json ; then
local sha=$(jq --raw-output .commit.sha < $TMP_DIR/tag.json) local sha=$(jq --raw-output .commit.sha < $TMP_DIR/tag.json)
if test "$sha" != "$SHA" ; then if test "$sha" != "$SHA" ; then
if test "$OVERRIDE" = "true"; then
echo "Removing existing tag, ${TAG}"
api DELETE repos/$REPO/tags/$TAG >& /dev/null || true
else
cat $TMP_DIR/tag.json cat $TMP_DIR/tag.json
echo "the tag SHA in the $REPO repository does not match the tag SHA that triggered the build: $SHA" echo "the tag SHA in the $REPO repository does not match the tag SHA that triggered the build: $SHA"
false false
fi fi
fi
else else
api POST repos/$REPO/tags --data-raw '{"tag_name": "'$TAG'", "target": "'$SHA'"}' api POST repos/$REPO/tags --data-raw '{"tag_name": "'$TAG'", "target": "'$SHA'"}'
fi fi