Skip to content

Commit 3c02b4d

Browse files
Pigbibicursoragent
andauthored
Deploy Cloud Run only after CI passes on main push. (#134)
Trigger deploy via workflow_run instead of parallel push, so main only publishes when unit tests succeed. Manual workflow_dispatch unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent bbd60e1 commit 3c02b4d

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

.github/workflows/sync-cloud-run-env.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
name: Deploy Cloud Run
22

33
on:
4-
push:
5-
branches: [ main ]
4+
workflow_run:
5+
workflows: [CI]
6+
types: [completed]
7+
branches: [main]
68
workflow_dispatch:
79

810
env:
@@ -22,9 +24,17 @@ concurrency:
2224
jobs:
2325
deploy-cloud-run:
2426
name: Deploy Cloud Run
27+
if: >
28+
github.event_name == 'workflow_dispatch' ||
29+
(
30+
github.event_name == 'workflow_run' &&
31+
github.event.workflow_run.conclusion == 'success' &&
32+
github.event.workflow_run.event == 'push'
33+
)
2534
runs-on: ubuntu-latest
2635
timeout-minutes: 20
2736
permissions:
37+
actions: read
2838
contents: read
2939
id-token: write
3040
env:
@@ -169,6 +179,8 @@ jobs:
169179
- name: Checkout repository
170180
if: steps.deploy_config.outputs.enabled == 'true'
171181
uses: actions/checkout@v6
182+
with:
183+
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}
172184

173185
- name: Validate deploy inputs
174186
if: steps.deploy_config.outputs.enabled == 'true'

0 commit comments

Comments
 (0)