Skip to content

CI: Don't cancel in-flight builds#201

Merged
stephencelis merged 1 commit intomainfrom
ci-concurrency
Sep 19, 2025
Merged

CI: Don't cancel in-flight builds#201
stephencelis merged 1 commit intomainfrom
ci-concurrency

Conversation

@stephencelis
Copy link
Member

I wish we could keep this setting, as it's wasteful to have multiple runners going at a time, but GitHub erroneously reports canceled builds as "failed" and badges the entire repo for that, which is not great for first impressions.

I've reported the issue here, so maybe we can revert this if they agree that this is incorrect behavior and address it: actions/runner#4047

@stephencelis stephencelis merged commit 8f4ab55 into main Sep 19, 2025
7 of 10 checks passed
@stephencelis stephencelis deleted the ci-concurrency branch September 19, 2025 18:26
@yamcodes
Copy link

yamcodes commented Nov 21, 2025

If you want to preserve cancel-in-progress but not have the badge show "failed" on cancelled runs, you can use the following hack that will give you this result. Note that it's obviously not as ideal as a real solution from actions/runner#4047, but for me it was good enough for now to be better than unnecessary parallel tests.

Basically, you create a "replica" workflow which will pass if the tests action passes, fails if it fails, but not if it's cancelled.
You can then play with this workflow's name and the a href of the badge to give you a pretty seamless result:

Test Status

sequenceDiagram
    autonumber
    actor User
    User->>+GitHub: Push to main
    GitHub->>+test.yml: Trigger workflow
    test.yml->>-GitHub: Complete (success/failure)
    GitHub->>+tests-badge.yml: Trigger on workflow_run
    tests-badge.yml->>tests-badge.yml: Check if main push (not cancelled)
    alt Conclusion == success
        tests-badge.yml->>tests-badge.yml: Output green badge
    else Other conclusion
        tests-badge.yml->>tests-badge.yml: Output red badge + exit 1
    end
    tests-badge.yml->>-GitHub: Complete
Loading

See example PR: yamcodes/arkenv#409

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.

3 participants