Skip to content

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

Merged
jdx merged 1 commit intomainfrom
ci/cancelled-fix
May 3, 2026
Merged

chore(ci): use !cancelled() instead of always() for final job#460
jdx merged 1 commit 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 CI-only change that just adjusts when the final job runs; main risk is slightly different status reporting when runs are cancelled.

Overview
Updates the GitHub Actions final aggregator job to use if: ${{ !cancelled() }} instead of always(), so it still runs for upstream success/failure but does not run for cancelled workflows (e.g., superseded runs under cancel-in-progress).

Adds clarifying comments to document why cancellation should skip the aggregator to avoid wasting runners and producing noise on cancelled commits.

Reviewed by Cursor Bugbot for commit 4c62d5f. 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

Replaces always() with !cancelled() on the final aggregator job so it respects the workflow's cancel-in-progress: true concurrency setting. The fix correctly avoids spinning up a runner — and producing error annotations — on superseded commits while still catching upstream failures and skips.

Confidence Score: 5/5

Safe to merge — minimal, correct one-line fix with no functional regressions on normal CI paths.

The change is a single condition swap on a non-critical aggregator job. Both success and failure cases are handled identically to before; only cancelled workflows behave differently (correctly skipping the job). No logic, data, or security concerns.

No files require special attention.

Important Files Changed

Filename Overview
.github/workflows/test.yml Single-line condition change on the final aggregator job from always() to !cancelled() — correct and well-commented fix.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[New commit pushed] --> B{cancel-in-progress}
    B -- "supersedes previous run" --> C[Previous workflow cancelled]
    B -- "no active run" --> D[Jobs run normally]
    C --> E{final job condition}
    D --> F[Jobs complete\nsuccess / failure / skipped]
    F --> G{final job condition}
    E -- "always() (old)" --> H[final runs anyway\nwastes runner, confusing annotations]
    E -- "!cancelled() (new)" --> I[final skipped ✓]
    G -- "!cancelled() (new)" --> J{Any failure/skipped/cancelled?}
    J -- yes --> K[exit 1 — CI fails ✓]
    J -- no --> L[exit 0 — CI passes ✓]
Loading

Reviews (1): Last reviewed commit: "chore(ci): use !cancelled() instead of a..." | Re-trigger Greptile

@jdx jdx merged commit c6a35e2 into main May 3, 2026
23 checks passed
@jdx jdx deleted the ci/cancelled-fix branch May 3, 2026 15:27
@jdx jdx mentioned this pull request May 3, 2026
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