diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 762faff..b9ebd24 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -18,9 +18,12 @@ on: # yamllint disable-line rule:truthy permissions: contents: read +# A newer push to the same pull request cancels the running run; a push to main or a tag +# never cancels another run. A tag run has its own group, so it never shares one with the +# main run of the same commit. concurrency: - group: build-${{ github.ref }} - cancel-in-progress: true + group: build-${{ github.event_name == 'pull_request' && github.ref || (github.ref_type == 'tag' && github.ref || github.sha) }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: build: diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index 0f69c3d..46074f4 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -19,10 +19,12 @@ on: # yamllint disable-line rule:truthy permissions: contents: read -# A newer push to the same ref makes the running lint obsolete. +# A newer push to the same pull request makes the running run obsolete. A push to main is +# never cancelled: each merge commit keeps its own result, so its group is the commit SHA. +# (This workflow has no tag trigger, so no tag branch in the group.) concurrency: - group: lint-${{ github.ref }} - cancel-in-progress: true + group: lint-${{ github.event_name == 'pull_request' && github.ref || github.sha }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: lint: diff --git a/changelogs/fragments/ci-concurrency-main-runs.yml b/changelogs/fragments/ci-concurrency-main-runs.yml new file mode 100644 index 0000000..9ac883d --- /dev/null +++ b/changelogs/fragments/ci-concurrency-main-runs.yml @@ -0,0 +1,4 @@ +trivial: + - >- + A later push to main no longer cancels the Lint and Build runs of an earlier one; pull request + runs still cancel their predecessors, and in the Build workflow a tag run has its own group.