Improve CI configuration: eliminate duplicate runs, add concurrency#2678
Merged
Conversation
The previous trigger `on: [push, pull_request]` caused CI to run twice on every PR — once from the push event on the branch, once from the pull_request event. By scoping to pull_request only, CI runs once per PR and no longer wastefully duplicates work. Also removes push-to-master CI — once branch protection requiring green builds is in place, every merge to master is guaranteed clean, making push-triggered CI on master redundant. Adds workflow_dispatch to allow manual CI triggering when needed.
Adds a concurrency group keyed on the git ref so that pushing new commits to a PR branch cancels any in-progress CI run for that branch. Prevents wasted compute when iterating quickly — only the latest commit's CI result matters.
Collaborator
Author
|
I have updated the configuration of the branch protection |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Three changes to the CI workflow that reduce wasted compute and speed up iteration:
1. Scope workflow trigger to pull_request only
The previous
on: [push, pull_request]triggered CI twice on every PR — once from the push event on the branch head, and once from the pull_request event. By scoping to PRs against master, each PR runs CI exactly once.Also adds
workflow_dispatchso CI can be triggered manually when needed (e.g., re-running after an infrastructure failure without a new push).2. Add concurrency group with cancel-in-progress
When iterating on a PR, only the latest commit's CI result matters. The concurrency group (keyed on git ref) cancels any in-progress run before starting a new one. No more waiting for a stale run to finish before seeing the result you actually care about.
3. Removed push-to-master CI (part of commit 1)
Once branch protection requiring green builds is in place, every merge to master is guaranteed clean — making push-triggered CI on master redundant.
Benefits
Setting up branch protection
After this merges, configure the repo to require green CI on master:
masterCommits