Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/auto-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ jobs:
echo "Creating tag: $TAG"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "$TAG" -m "Release $TAG"
# The "[auto-tag]" marker in the tag message tells release.yml to skip
# this tag (#278, #282). Keep it in sync with the guard job there.
git tag -a "$TAG" -m "Release $TAG [auto-tag]"
git push origin "$TAG"
echo "Successfully created and pushed tag: $TAG"
echo "created=true" >> $GITHUB_OUTPUT
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ jobs:
# 0. Skip tags pushed by auto-tag.yml. auto-tag pushes with RELEASE_PAT, which
# (unlike GITHUB_TOKEN) fires this workflow too; without this guard both
# workflows create the same release and race on the SBOM upload (#278).
# auto-tag creates annotated tags as github-actions[bot], so the tagger
# tells them apart from tags pushed by hand.
# auto-tag puts an explicit "[auto-tag]" marker in the tag message (#282).
# The github-actions[bot] tagger check covers tags created before the
# marker was introduced.
guard:
runs-on: ubuntu-latest
outputs:
Expand All @@ -51,11 +52,13 @@ jobs:
fi
read -r TYPE SHA < <(gh api "repos/${{ github.repository }}/git/ref/tags/${TAG}" --jq '.object.type + " " + .object.sha')
TAGGER=""
MESSAGE=""
if [ "$TYPE" = "tag" ]; then
TAGGER=$(gh api "repos/${{ github.repository }}/git/tags/${SHA}" --jq '.tagger.name')
MESSAGE=$(gh api "repos/${{ github.repository }}/git/tags/${SHA}" --jq '.message')
fi
echo "Tag ${TAG}: type=${TYPE}, tagger=${TAGGER:-<none>}"
if [ "$TAGGER" = "github-actions[bot]" ]; then
echo "Tag ${TAG}: type=${TYPE}, tagger=${TAGGER:-<none>}, message=${MESSAGE:-<none>}"
if [[ "$MESSAGE" == *"[auto-tag]"* ]] || [ "$TAGGER" = "github-actions[bot]" ]; then
echo "Tag was created by auto-tag.yml, which handles the release. Skipping."
echo "skip=true" >> "$GITHUB_OUTPUT"
else
Expand Down
Loading