Skip to content

chore(ci): use !cancelled() instead of always() for final job#70

Merged
jdx merged 2 commits intomainfrom
ci/cancelled-fix
May 3, 2026
Merged

chore(ci): use !cancelled() instead of always() for final job#70
jdx merged 2 commits intomainfrom
ci/cancelled-fix

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented May 3, 2026

Summary

  • Combined with the workflow's cancel-in-progress group, if: always() overrides cancellation and runs the final aggregator even on superseded commits.
  • !cancelled() still runs on upstream success or failure but skips when the workflow is cancelled — saves a runner and avoids confusing error annotations on already-superseded shas.
  • Caught by Cursor Bugbot on a sibling repo (chore(ci): add final aggregator job for branch protection endevco/pitchfork#413). Same final-aggregator pattern + cancel-in-progress: true here, so the same fix applies.

Test plan

  • CI passes on this PR

🤖 Generated with Claude Code


Note

Low Risk
Low risk: only adjusts a GitHub Actions if condition so the final aggregator job doesn’t run on cancelled/superseded workflows, reducing wasted runners and noisy failures.

Overview
Updates the CI workflow so the final aggregator job runs for upstream success/failure but skips when the workflow is cancelled by replacing if: always() with if: ${{ !cancelled() }}.

This prevents cancel-in-progress superseded runs from still executing final and emitting misleading failure annotations.

Reviewed by Cursor Bugbot for commit 6b74546. Bugbot is set up for automated code reviews on this repo. Configure here.

Combined with the workflow's `cancel-in-progress` group, `if: always()`
overrides cancellation and runs the aggregator even on superseded
commits. `!cancelled()` still runs on upstream success or failure but
skips when the workflow is cancelled.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@gemini-code-assist
Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 3, 2026

Greptile Summary

This PR replaces if: always() with if: ${{ !cancelled() }} on the final aggregator job in the CI workflow. Combined with the existing cancel-in-progress: true concurrency group, this allows GitHub Actions to properly cancel the final job on superseded runs, avoiding wasted runner time and confusing failure annotations on stale SHAs. The logic of the aggregator itself is unchanged.

Confidence Score: 5/5

Safe to merge — minimal, well-motivated change with no impact on build/test logic.

Single-line change to a CI condition with a clear explanation. The !cancelled() expression is the standard GitHub Actions idiom for this pattern and correctly interacts with cancel-in-progress: true. No code paths, tests, or release logic are affected.

No files require special attention.

Important Files Changed

Filename Overview
.github/workflows/ci.yml One-line fix replacing always() with !cancelled() on the final aggregator job so cancel-in-progress can properly skip it on superseded runs.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[New push triggers workflow] --> B{cancel-in-progress}
    B -- "supersedes previous run" --> C[Previous run cancelled]
    C --> D{final job condition}
    D -- "always() — OLD" --> E[final runs anyway\nwastes runner, noisy annotation]
    D -- "!cancelled() — NEW" --> F[final skipped\nclean cancellation]
    B -- "no superseding push" --> G[test + msrv jobs run]
    G --> H{all success?}
    H -- yes --> I[final runs — exits 0]
    H -- no --> J[final runs — exits 1\nmarks PR red]
Loading

Reviews (2): Last reviewed commit: "Merge branch 'main' into ci/cancelled-fi..." | Re-trigger Greptile

@jdx jdx enabled auto-merge (squash) May 3, 2026 15:27
@jdx jdx merged commit 96c8dfd into main May 3, 2026
8 checks passed
@jdx jdx deleted the ci/cancelled-fix branch May 3, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant