From de8decf11391661938327b8ac1f0d53a0bea5700 Mon Sep 17 00:00:00 2001 From: yiling Date: Tue, 6 Oct 2026 11:49:49 +0800 Subject: [PATCH] fix(ci): prevent tagging main on PR workflow_dispatch docker builds --- .github/workflows/release.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 93478794..2074a4ce 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -24,6 +24,7 @@ jobs: steps: - name: Checkout repository + id: checkout uses: actions/checkout@v4 with: ref: ${{ inputs.pr && format('refs/pull/{0}/head', inputs.pr) || github.ref }} @@ -57,8 +58,11 @@ jobs: crpi-000nkafzu6xvpwsc.cn-hongkong.personal.cr.aliyuncs.com/shumai-one/shumai tags: | type=semver,pattern={{version}} - type=ref,event=branch + type=ref,event=branch,enable=${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && !inputs.pr && !inputs.tag) }} + type=raw,value=pr-${{ inputs.pr }},enable=${{ github.event_name == 'workflow_dispatch' && inputs.pr != '' && inputs.tag == '' }} type=raw,value=${{ inputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' && inputs.tag != '' }} + labels: | + org.opencontainers.image.revision=${{ steps.checkout.outputs.commit }} # Build and push Docker image - name: Build and push Docker image