diff --git a/.github/workflows/mirror_gitee.yml b/.github/workflows/mirror_gitee.yml index b10e2be62e..0d7205a03e 100644 --- a/.github/workflows/mirror_gitee.yml +++ b/.github/workflows/mirror_gitee.yml @@ -1,13 +1,23 @@ name: Mirror to Gitee Repo +# Ref creation is also delivered as a push event, but deletion may only emit a +# delete event. Keep both triggers so removed branches and tags are pruned from +# the mirror without launching duplicate mirrors for ref creation. on: push: - branches-ignore: - - "copilot/**" - - "dependabot/**" - - "pre-commit-ci-update-config" + # Use positive patterns with exclusions so tag pushes can be listed below. + # `branches-ignore` by itself disables all tag-triggered runs. + branches: + - "**" + # GitHub creates these ephemeral refs while testing a merge queue entry. + # They are neither source branches nor refs that Gitee should receive. + - "!gh-readonly-queue/**" + - "!copilot/**" + - "!dependabot/**" + - "!pre-commit-ci-update-config" + tags: + - "**" delete: - create: # Ensures that only one mirror task will run at a time. concurrency: @@ -15,8 +25,14 @@ concurrency: jobs: git-mirror: - if: github.repository_owner == 'deepmodeling' - runs-on: ubuntu-slim + # Delete events use the default branch as `github.ref`, so inspect the + # payload ref to suppress only ephemeral merge-queue branch deletions. + if: >- + github.repository_owner == 'deepmodeling' && + (github.event_name != 'delete' || + !startsWith(github.event.ref, 'gh-readonly-queue/')) + # This is a Docker action; ubuntu-slim does not provide a Docker daemon. + runs-on: ubuntu-latest steps: - uses: wearerequired/git-mirror-action@v1 env: