From cc842575b9760f76a3f916f31552fcbc2d28f754 Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Tue, 20 Jan 2026 19:38:35 +0200 Subject: [PATCH] fix: add tag existence check to version-maintenance workflow (#425) * fix: add tag existence check to version-maintenance workflow Prevents workflow failure when major version tag doesn't exist by checking for and creating the tag before running action-versioning. * fix: add git config for tag creation in version-maintenance workflow GitHub Actions runners don't have default git user configuration, which causes annotated tag creation to fail. Add user.name and user.email config before creating tags. --- .github/workflows/version-maintenance.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/version-maintenance.yml b/.github/workflows/version-maintenance.yml index 4ddaf37..85e6555 100644 --- a/.github/workflows/version-maintenance.yml +++ b/.github/workflows/version-maintenance.yml @@ -40,6 +40,29 @@ jobs: printf '%s\n' "major=v$current_year" >> "$GITHUB_OUTPUT" fi + - name: Ensure Major Version Tag Exists + id: ensure-tag + shell: sh + env: + MAJOR_VERSION: ${{ steps.version.outputs.major }} + run: | + set -eu + + git fetch --tags --force + + if git rev-list -n 1 "$MAJOR_VERSION" >/dev/null 2>&1; then + echo "Tag $MAJOR_VERSION already exists" + printf '%s\n' "created=false" >> "$GITHUB_OUTPUT" + else + echo "Tag $MAJOR_VERSION not found, creating..." + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag -a "$MAJOR_VERSION" -m "Major version $MAJOR_VERSION" + git push origin "$MAJOR_VERSION" + echo "Created and pushed tag $MAJOR_VERSION" + printf '%s\n' "created=true" >> "$GITHUB_OUTPUT" + fi + - name: Run Action Versioning id: action-versioning uses: ./action-versioning