fix(ci): restrict workflow_run deployments to trusted main pushes

This commit is contained in:
xixu-me committed 2026-03-14 01:02:18 +08:00
1 parent 394547cf1b
commit 99cd258c8b
4 files changed
+16 -5

No files matched your search

+2 -2
View File
@@ -19,7 +19,7 @@ jobs:
timeout-minutes: 15
permissions:
contents: write
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' && github.event.workflow_run.head_branch == 'main' && github.event.workflow_run.head_repository.full_name == github.repository) }}
steps:
- name: Checkout main branch
@@ -91,7 +91,7 @@ jobs:
timeout-minutes: 15
permissions:
contents: write
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' && github.event.workflow_run.head_branch == 'main' && github.event.workflow_run.head_repository.full_name == github.repository) }}
steps:
- name: Checkout main branch