Skip to content

Commit ca1f781

Browse files
IONOS(ci): unify concurrency group across push and pull_request runs
Previously the concurrency group used `pr-<num>` for pull_request events and `<github.ref>` for push events on non-protected branches, so a `*/dev/*` branch with an open PR produced two parallel runs on every push: a `push` event run keyed on `refs/heads/<branch>` and a `pull_request: synchronize` run keyed on `pr-<num>`. Different group keys meant `cancel-in-progress` never applied between them. Unify the key to `github.head_ref || github.ref_name` for all non- protected branches. For pull_request that resolves to the source branch name; for push it falls back to `ref_name`. Both events now share the same group and the later-arriving run cancels the older one — in practice the `pull_request: synchronize` event arrives a few seconds after `push`, so the PR run wins and remains the PR status check. Trade-off: `trigger-remote-dev-workflow` is gated to `push` events on `ionos-dev|ionos-stable|rc/*|*/dev/*`, so it will not fire on dev-branch pushes while a PR is open from that branch. It still fires on direct pushes to protected branches (ionos-dev/stable/rc/*), whose group is keyed per `github.run_id` and therefore never cancels, and on dev-branch pushes once the PR is closed/merged. Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
1 parent 658c921 commit ca1f781

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

.github/workflows/hidrive-next-build.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,18 @@ on:
5252
type: string
5353
default: ''
5454

55+
# Concurrency group is intentionally shared between push and pull_request runs
56+
# of the same source branch, so a `*/dev/*` branch with an open PR does not
57+
# produce two parallel runs. Protected branches (ionos-dev/stable/rc/*) use a
58+
# unique-per-run-id key so consecutive pushes never cancel each other.
5559
concurrency:
5660
group: >-
5761
${{ github.workflow }}-${{
58-
github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) ||
5962
(
60-
(
61-
contains(fromJson('["refs/heads/ionos-dev","refs/heads/ionos-stable"]'), github.ref) ||
62-
startsWith(github.ref, 'refs/heads/rc/')
63-
) && github.run_id ||
64-
github.ref
65-
)
63+
contains(fromJson('["refs/heads/ionos-dev","refs/heads/ionos-stable"]'), github.ref) ||
64+
startsWith(github.ref, 'refs/heads/rc/')
65+
) && github.run_id ||
66+
(github.head_ref || github.ref_name)
6667
}}
6768
cancel-in-progress: true
6869

0 commit comments

Comments
 (0)