pr-git-2369/HaraldNordgren/cancel-stale-pr-ci-v2
tagged this
30 Aug 10:59
From: Harald Nordgren <haraldnordgren@gmail.com>
The CI workflow previously grouped all runs by commit hash using
`group: ${{ github.sha }}`. This meant every push to a pull
request started a separate workflow run, and all workflows
triggered by the same commit shared the same concurrency group.
With this change, pull request runs are grouped by pull request
number instead of commit hash, and runs superseded by a newer
push are canceled. The concurrency group becomes
`${{ github.workflow }}-${{ github.event.pull_request.number ||
github.sha }}` and `cancel-in-progress` is set to true for
pull request events.
For pull request events, the group is `<workflow>-<pull-request-number>`
(e.g., "main-workflow-42"). If you push a new commit to an
existing pull request before the CI working on it finishes, the
new request will be placed in the same group and cancel the
currently running run.
For non-pull-request events, the group is `${{ github.workflow }}-${{
github.sha }}` and `cancel-in-progress` defaults to false, so
there is no regression in behavior.
Note that the previous configuration used `group: ${{ github.sha }}`,
which meant all workflows sharing the same commit hash were in the
same group. The new configuration includes the workflow name in
the group, so each workflow has its own concurrency group per
commit/PR.
Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
Submitted-As: https://lore.kernel.org/git/pull.2369.v2.git.git.1788087560290.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.2369.git.git.1785492641983.gitgitgadget@gmail.com