From f002bafe8684d397a0d2ffea460073d5b83ed7e5 Mon Sep 17 00:00:00 2001 From: Alex Kanitz Date: Tue, 10 Nov 2026 21:01:37 +0100 Subject: [PATCH] ci: cancel PR runs only for new commits A newer run on the same commit (e.g. for an edit of the description) cancelled the run in progress, and its failed gate then blocked the merge. Only the first attempt of a run for a pull request's synchronize action now cancels runs in progress, as in "Cancelled runs" of actions/gate/README.md in elixir-cloud-aai/.github. Part of elixir-cloud-aai/.github#73 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV --- .github/workflows/ci.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 316b1e62..a9b28662 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,11 +36,14 @@ env: # can't read `env`, so `push` and `publish` repeat the expression PUBLISH: ${{ github.event_name == 'push' && (github.repository_owner == 'elixir-cloud-aai' || vars.DOCKERHUB_ORG != '') }} -# Cancel superseded runs of a pull request; runs for pushes get their own -# group, so that queued runs for successive pushes are not dropped. Runs for -# edits that leave the title unchanged (e.g., of the description, also by bots) -# share a group of their own, so that they cancel each other but not the run -# for the pull request's commit +# Only a new head commit of a pull request cancels its runs in progress +# (action `synchronize`, first attempt); runs for other actions and reruns +# wait, so that a run on the same commit never leaves a cancelled, failed +# `CI passed` (see "Cancelled runs" in `actions/gate/README.md` of +# `elixir-cloud-aai/.github`). Runs for pushes get their own group, so that +# none is dropped. Runs for edits that leave the title unchanged (e.g. of +# the description, also by bots) share a group of their own, so that they +# don't wait for the run for the pull request's commit concurrency: group: >- ${{ github.workflow }}-${{ @@ -48,7 +51,10 @@ concurrency: github.event.action == 'edited' && !github.event.changes.title && format('{0}-edited', github.ref) || github.ref }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} + cancel-in-progress: >- + ${{ github.event_name == 'pull_request' + && github.event.action == 'synchronize' + && github.run_attempt == 1 }} jobs: