Skip to content

Commit 9ed4ae8

Browse files
committed
GH Actions/test: allow concurrency for build against "main" branches
The `concurrency` setting will cancel running workflows is a new push to the same branch is seen. This is useful to prevent unnecessary workflow runs (as the previous push was superseded, so the outcome is no longer relevant). However, for the "main" branches (`master` and `4.0`), this workflow cancelling means that if multiple PRs are merged in succession, only the code coverage for the _last_ merge is recorded in Coveralls as the workflow runs on `master` for the previous merges will have been cancelled. While in practice, it's not a biggie, it does make it more difficult to identify which commit/merge added or decreased code coverage. With this in mind, I'm making a small change to the `concurrency` setting for the `test` workflow only to allow those to always finish when the workflow is run for the "main" branches.
1 parent a480170 commit 9ed4ae8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ on:
1414
# Allow manually triggering the workflow.
1515
workflow_dispatch:
1616

17-
# Cancels all previous workflow runs for the same branch that have not yet completed.
17+
# Cancels all previous workflow runs for the same branch that have not yet completed,
18+
# but don't cancel when it's one of the "main" branches as that prevents
19+
# accurate monitoring of code coverage.
1820
concurrency:
1921
# The concurrency group contains the workflow name and the branch name.
2022
group: ${{ github.workflow }}-${{ github.ref }}
21-
cancel-in-progress: true
23+
cancel-in-progress: ${{ github.ref_name != 'master' && github.ref_name != '4.0' }}
2224

2325
jobs:
2426
build:

0 commit comments

Comments
 (0)