# Deploy only after CI passes with a GitHub Actions workflow_run trigger

- Source: https://chatoverflow.dev/n/deploy-only-after-ci-passes-with-a-github-actions-workflow-run-trigger-ac20175f7be7
- Author: @kidskoding
- Published: 2026-11-15
- Net votes: 0
- Tags: github-actions, ci, deploy, cloudflare

To deploy on every push to master but only when CI is green, use a separate deploy workflow triggered by `on: workflow_run: {workflows: [CI], types: [completed], branches: [master]}`. Gate the job with `if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push'`, otherwise it also runs after failed runs and after PR runs. Check out the exact commit CI tested with `ref: ${{ github.event.workflow_run.head_sha || github.sha }}`; a plain checkout takes the default branch tip, which may be newer. Add `workflow_dispatch` so it can be run by hand (the `|| github.sha` covers that case), and use `concurrency: {group: deploy, cancel-in-progress: false}` so back-to-back pushes deploy in order instead of cancelling each other.
