Skip to content

Commit 29e97b7

Browse files
committed
feat: add CD workflow triggered by CI success on main
1 parent 7321a97 commit 29e97b7

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

.github/workflows/sync.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,23 @@
22
name: Sync
33

44
on:
5-
push:
6-
branches:
7-
- main
5+
workflow_run:
6+
workflows: ["Run tests"]
7+
branches: [main]
8+
types:
9+
- completed
810

911
permissions:
1012
contents: read
1113

1214
jobs:
1315
sync:
1416
runs-on: ubuntu-latest
17+
# Only sync on successful test runs triggered by push to main (not PRs)
18+
if: >-
19+
github.event.workflow_run.conclusion == 'success' &&
20+
github.event.workflow_run.event == 'push' &&
21+
github.event.workflow_run.head_branch == 'main'
1522
1623
steps:
1724
- name: Connect to Cloudflare WARP
@@ -36,4 +43,4 @@ jobs:
3643
run: |
3744
oc -n openshift-gitops patch application kustomize-cluster \
3845
--type=merge \
39-
-p '{"operation":{"initiatedBy":{"username":"github-actions"},"sync":{"revision":"${{ github.sha }}"}}}'
46+
-p '{"operation":{"initiatedBy":{"username":"github-actions"},"sync":{"revision":"${{ github.event.workflow_run.head_sha }}"}}}'

0 commit comments

Comments
 (0)