From 993307e788ee4da0138d8993e8621388b6ec1bf3 Mon Sep 17 00:00:00 2001 From: tianma-if Date: Wed, 26 Aug 2026 21:55:05 +0800 Subject: [PATCH] ci(docker): limit TCR sync to releases --- .github/workflows/docker-tcr-mirror.yml | 21 +-------------------- scripts/docker-release.test.mjs | 7 +++---- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/.github/workflows/docker-tcr-mirror.yml b/.github/workflows/docker-tcr-mirror.yml index b818db78..4c93e17e 100644 --- a/.github/workflows/docker-tcr-mirror.yml +++ b/.github/workflows/docker-tcr-mirror.yml @@ -1,11 +1,6 @@ name: Build Tencent TCR image through CNB on: - workflow_run: - workflows: - - Build and publish Docker image - types: - - completed release: types: - published @@ -29,17 +24,7 @@ concurrency: jobs: sync-source: - if: >- - github.repository == 'tianma-if/edgeever' && - ( - github.event_name == 'release' || - github.event_name == 'workflow_dispatch' || - ( - github.event_name == 'workflow_run' && - github.event.workflow_run.conclusion == 'success' && - github.event.workflow_run.event == 'push' - ) - ) + if: github.repository == 'tianma-if/edgeever' name: Trigger asynchronous Tencent-side image build runs-on: ubuntu-latest timeout-minutes: 5 @@ -49,16 +34,12 @@ jobs: env: EVENT_NAME: ${{ github.event_name }} RELEASE_TAG: ${{ github.event.release.tag_name }} - WORKFLOW_SHA: ${{ github.event.workflow_run.head_sha }} INPUT_SOURCE_REF: ${{ inputs.source_ref }} INPUT_DESTINATION_REF: ${{ inputs.destination_ref }} run: | if [[ "${EVENT_NAME}" == "release" ]]; then source_ref="${RELEASE_TAG}" destination_ref="${RELEASE_TAG}" - elif [[ "${EVENT_NAME}" == "workflow_run" ]]; then - source_ref="${WORKFLOW_SHA}" - destination_ref="main" else source_ref="${INPUT_SOURCE_REF}" destination_ref="${INPUT_DESTINATION_REF}" diff --git a/scripts/docker-release.test.mjs b/scripts/docker-release.test.mjs index a23de033..ab7cd3e8 100644 --- a/scripts/docker-release.test.mjs +++ b/scripts/docker-release.test.mjs @@ -117,11 +117,10 @@ describe("Docker release contract", () => { expect(mirrorWorkflow).toContain( "name: Build Tencent TCR image through CNB", ); - expect(mirrorWorkflow).toContain("workflow_run:"); + expect(mirrorWorkflow).not.toContain("workflow_run:"); expect(mirrorWorkflow).toContain("release:"); - expect(mirrorWorkflow).toContain( - "github.event.workflow_run.event == 'push'", - ); + expect(mirrorWorkflow).toContain("types:\n - published"); + expect(mirrorWorkflow).toContain("workflow_dispatch:"); expect(mirrorWorkflow).toContain("secrets.CNB_TCR_BUILD_PUSH_TOKEN"); expect(mirrorWorkflow).toContain("https://cnb.cool/tianma-if/edgeever"); expect(mirrorWorkflow).toContain('"HEAD:${destination}"');