From 599dec74addfd5b338d9288313ff9ea6bf90e174 Mon Sep 17 00:00:00 2001 From: giswqs Date: Sat, 14 Nov 2026 12:33:12 -0500 Subject: [PATCH 1/2] ci: a pull request's runs no longer share main's concurrency group A pull_request run GitHub creates after its pull request has merged gets the base branch's ref, refs/heads/main. CI, Reference answers and Docker images group their runs by github.ref, so such a late run joined main's group and cancelled main's run: #2028's last push was only run after the merge, and CI on main's head (a13d490f) was cancelled a second later. In docker.yml it could stop a run publishing main's images. Pull request runs are now grouped by the pull request's number. --- .github/workflows/ci.yml | 5 ++++- .github/workflows/docker.yml | 6 ++++-- .github/workflows/reference.yml | 5 ++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4471df8b70..efd7129c65 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,8 +18,11 @@ on: options: [all, linux] default: all +# A pull request's runs are grouped by its number, not by github.ref: a run GitHub creates after +# the pull request has merged gets the base branch's ref (refs/heads/main), and would otherwise +# join main's group and cancel main's run. concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.event.pull_request.number && format('pr-{0}', github.event.pull_request.number) || github.ref }} cancel-in-progress: true env: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 319011ba1d..e803d6f237 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -45,9 +45,11 @@ permissions: # One run at a time per ref, so pushes and manual runs on main publish `edge` in order. A publishing # run always finishes (a cancelled one could leave the CLI's tags half updated); a newer push only -# replaces a run that is still waiting. A pull request's newer push cancels its older run. +# replaces a run that is still waiting. A pull request's newer push cancels its older run. A pull +# request's runs are grouped by its number, not by github.ref: a run GitHub creates after the pull +# request has merged gets refs/heads/main, and would otherwise cancel main's publishing run. concurrency: - group: docker-${{ github.ref }} + group: docker-${{ github.event.pull_request.number && format('pr-{0}', github.event.pull_request.number) || github.ref }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} env: diff --git a/.github/workflows/reference.yml b/.github/workflows/reference.yml index f55b3441d5..f29dbe9b3b 100644 --- a/.github/workflows/reference.yml +++ b/.github/workflows/reference.yml @@ -16,8 +16,11 @@ on: permissions: contents: read +# A pull request's runs are grouped by its number, not by github.ref: a run GitHub creates after +# the pull request has merged gets the base branch's ref (refs/heads/main), and would otherwise +# join main's group and cancel main's run. concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }}-${{ github.event.pull_request.number && format('pr-{0}', github.event.pull_request.number) || github.ref }} cancel-in-progress: true jobs: From d1e3585673b8c00549ecc4b8262ac30c5cbabbbe Mon Sep 17 00:00:00 2001 From: giswqs Date: Sat, 14 Nov 2026 13:32:31 -0500 Subject: [PATCH 2/2] ci(docker): a pull request's run never publishes, even with main's ref A pull_request run created after its pull request merged has github.ref refs/heads/main, so PUBLISH, the latest tag and cli-manifest treated it as main's run and published from the pull request's merge commit. Each now also requires an event other than pull_request. --- .github/workflows/docker.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index e803d6f237..d138d5ae58 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -54,8 +54,9 @@ concurrency: env: # Only main and releases publish; a pull request, or a manual run on another branch, only builds - # and smoke-tests. (cli-manifest repeats this in its `if`, where env isn't available.) - PUBLISH: ${{ github.event_name == 'release' || github.ref == 'refs/heads/main' }} + # and smoke-tests. A pull request is told by its event, not its ref: a run created after it merged + # has refs/heads/main. (cli-manifest repeats this in its `if`, where env isn't available.) + PUBLISH: ${{ github.event_name == 'release' || (github.event_name != 'pull_request' && github.ref == 'refs/heads/main') }} WEB_IMAGE: ghcr.io/opengeos/rustgis CLI_IMAGE: ghcr.io/opengeos/rustgis-cli # The tags of both images (docker/metadata-action); `latest` follows main, as `edge` does. @@ -64,7 +65,7 @@ env: type=sha,enable=${{ github.event_name != 'release' }} type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} - type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} + type=raw,value=latest,enable=${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }} jobs: web: @@ -256,7 +257,7 @@ jobs: cli-manifest: name: Command line image (publish) needs: cli - if: github.repository == 'opengeos/RustGIS' && (github.event_name == 'release' || github.ref == 'refs/heads/main') + if: github.repository == 'opengeos/RustGIS' && (github.event_name == 'release' || (github.event_name != 'pull_request' && github.ref == 'refs/heads/main')) runs-on: ubuntu-latest timeout-minutes: 10 permissions: