ci: add concurrency control to build workflows#474
Conversation
Add concurrency cancels for GitHub Actions workflows that build on PRs. This ensures that in-progress runs are cancelled when new ones are started for the same branch. The following workflows were updated: - build-appimage.yml - build-appx.yml - build-flatpak.yml - build-release.yml - build-snap.yml - build-test.yml - build-wasm.yml The `build-clang-format.yml` workflow was intentionally excluded.
Reviewer's GuideAdds GitHub Actions concurrency settings to all PR/build workflows (except clang-format) so that older runs for the same branch are cancelled when a new run starts. Sequence diagram for GitHub Actions concurrency cancellation on new PR buildsequenceDiagram
actor Developer
participant GitHubRepo
participant GitHubActions
participant WorkflowRunOld
participant WorkflowRunNew
Developer->>GitHubRepo: push commits to branch
GitHubRepo-->>GitHubActions: trigger workflow with concurrency_group
GitHubActions->>WorkflowRunOld: start run (concurrency_group)
Developer->>GitHubRepo: push new commits to same branch
GitHubRepo-->>GitHubActions: trigger new workflow with same concurrency_group
GitHubActions->>WorkflowRunOld: cancel in progress (cancel_in_progress true)
GitHubActions->>WorkflowRunNew: start new run (same concurrency_group)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/workflows/build-appimage.yml" line_range="12-14" />
<code_context>
pull_request:
workflow_dispatch:
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
+ cancel-in-progress: true
+
jobs:
</code_context>
<issue_to_address>
**suggestion:** Consider whether you want concurrency to apply to push/workflow_dispatch events as well, not only PRs.
With this `group` expression, PR runs are grouped by `head_ref` and will be cancelled on new pushes to the same PR, but `push`/`workflow_dispatch` runs are grouped by `sha`, so `cancel-in-progress: true` effectively does nothing for them. If you also want cancellation for non-PR runs (e.g., on new commits to the same branch or manual re-runs), consider using `github.ref` or another branch-level identifier instead of `github.sha` for those events.
```suggestion
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
cancel-in-progress: true
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} | ||
| cancel-in-progress: true |
There was a problem hiding this comment.
suggestion: Consider whether you want concurrency to apply to push/workflow_dispatch events as well, not only PRs.
With this group expression, PR runs are grouped by head_ref and will be cancelled on new pushes to the same PR, but push/workflow_dispatch runs are grouped by sha, so cancel-in-progress: true effectively does nothing for them. If you also want cancellation for non-PR runs (e.g., on new commits to the same branch or manual re-runs), consider using github.ref or another branch-level identifier instead of github.sha for those events.
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} | |
| cancel-in-progress: true | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} | |
| cancel-in-progress: true |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #474 +/- ##
===========================================
- Coverage 66.48% 25.52% -40.97%
===========================================
Files 85 506 +421
Lines 4186 41525 +37339
Branches 255 4529 +4274
===========================================
+ Hits 2783 10598 +7815
- Misses 1403 30927 +29524 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add concurrency cancels for GitHub Actions workflows that build on PRs. This ensures that in-progress runs are cancelled when new ones are started for the same branch.
The following workflows were updated:
The
build-clang-format.ymlworkflow was intentionally excluded.Summary by Sourcery
CI: