Skip to content

Commit 4966505

Browse files
committed
Fix deploy.yml: skip build when nightly cron fails
The workflow_run trigger fires on both 'success' and 'failure' conclusions. Without a guard, every failed cron run wastes a full CI build + deploy cycle. Added an `if` condition to the build job: - push / workflow_dispatch events → always deploy - workflow_run (cron) events → only deploy when conclusion == 'success' This replaces the stale commented-out condition that referenced the old pull_request trigger (removed in a prior commit). https://claude.ai/code/session_01YafYX7riVJoSoZxYm913F6
1 parent 8a93a28 commit 4966505

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

.github/workflows/deploy.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@ permissions:
2323
jobs:
2424
build:
2525
runs-on: ubuntu-latest
26-
# Only run if the CO2 Emissions Check Cron Job completes successfully
27-
# or if there is a merge into the main branch
28-
# if: ${{ github.event.pull_request.merged == true || github.event.workflow_run.conclusion == 'success' }}
26+
# Skip the build when triggered by a failed cron run.
27+
# - push events (PR merges, direct commits to main) always deploy.
28+
# - workflow_dispatch (manual trigger) always deploys.
29+
# - workflow_run (after nightly cron) only deploys when the cron succeeded.
30+
if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
2931
steps:
3032
- name: Checkout your repository using git
3133
uses: actions/checkout@v4

0 commit comments

Comments
 (0)