-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Current Behavior
When a PR branch receives multiple commits in quick succession, multiple GitHub Actions workflow runs are triggered for the same checks and run in parallel.
For example, if a developer pushes several commits to fix linting or test failures, multiple runs of workflows such as Smoke Test, E2E Test, or other validation jobs execute simultaneously. These runs operate on different commit states but still consume CI resources.
This results in:
- Wasted CI minutes and compute resources
- Multiple overlapping workflow runs in the PR checks section
- Confusing red/green signals during code review
- Slower feedback loops for contributors
Desired Behavior
For each pull request branch, only the latest workflow run should remain active.
If a new commit is pushed to the same PR branch while a workflow is already running, the previous workflow runs should be automatically cancelled. This ensures that CI only validates the most recent commit state.
Implementation
This can be implemented by enabling GitHub Actions concurrency control in PR validation workflows.
Add a concurrency configuration to workflow files so that only one run per PR branch remains active:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: trueThis configuration ensures that:
- Workflow runs are grouped per workflow and branch
- When a new run starts for the same group, the previous run is automatically cancelled
This change should be applied to CI workflows that are triggered on pull requests.
Acceptance Tests
The issue can be considered resolved when:
- When multiple commits are pushed quickly to the same PR branch, only the latest workflow run continues.
- Any previous in-progress runs are automatically cancelled.
- CI checks shown in the PR correspond only to the latest commit state.
- CI minutes consumption is reduced and workflow noise in the PR interface is minimized.
Checklist
- I have read and followed the project's code of conduct.
- I have searched for similar issues before creating this one.
- I have provided all the necessary information to understand and reproduce the issue.
- I am willing to contribute to the resolution of this issue.