From a558dc786c136dd3f65c4830013e02ac18413807 Mon Sep 17 00:00:00 2001 From: CabLate <85614048+cablate@users.noreply.github.com> Date: Wed, 16 Sep 2026 19:55:51 +0800 Subject: [PATCH] fix: skip duplicate release events for tagged main --- .github/workflows/release.yml | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index df5922a..18ae7c0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,10 +9,32 @@ concurrency: cancel-in-progress: false jobs: - release: - # Skip automated version bump commits + check: + # Skip automated version bump commits and stale push events for an already tagged main. if: "!contains(github.event.head_commit.message, 'chore: release')" runs-on: ubuntu-latest + outputs: + needed: ${{ steps.unreleased.outputs.needed }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check whether main is already released + id: unreleased + run: | + git fetch origin main --tags + if git describe --tags --exact-match --match 'v[0-9]*' origin/main >/dev/null 2>&1; then + echo "needed=false" >> "$GITHUB_OUTPUT" + echo "Current main already has a version tag; no release needed" + else + echo "needed=true" >> "$GITHUB_OUTPUT" + fi + + release: + needs: check + if: needs.check.outputs.needed == 'true' + runs-on: ubuntu-latest permissions: contents: write id-token: write