Skip to content

Commit

Permalink
.github/workflows: Cancel redundant workflow runs
Browse files Browse the repository at this point in the history
Evern since the move to github actions in 70daa61 (CI: add GH actions for
main and release builds, 2023-04-20) we just executed the workflows for
every branch push.

This can quickly result in the workflow queue being clogged. There is also
no point in executing older versions of the same branch when a newer
version is available.

The version here supports multiple workflows [1]. And also cancels, on
purpose, redundant workflows on main and the release branches. See [2]
for a future way to don't do that on special branches.

[1]: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
[2]: https://stackoverflow.com/questions/68418857/how-to-cancel-existing-runs-when-a-new-push-happens-on-github-actions-but-only
  • Loading branch information
t-b committed Sep 8, 2023
1 parent a199c63 commit ba69a12
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ on:
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:

BuildInstaller:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
defaults:
run:
shell: bash
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:

CallPR:
Expand Down

0 comments on commit ba69a12

Please sign in to comment.