From e3ea8c719c43f36d0b77bebcd91da9bc8151b765 Mon Sep 17 00:00:00 2001 From: Alex Kanitz Date: Tue, 10 Nov 2026 20:58:07 +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 | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b3b4cc..f2cdad2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,9 +15,19 @@ on: permissions: contents: read +# 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 concurrency: - group: ci-${{ github.ref }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} + group: >- + ci-${{ github.event_name == 'push' && github.sha || github.ref }} + cancel-in-progress: >- + ${{ github.event_name == 'pull_request' + && github.event.action == 'synchronize' + && github.run_attempt == 1 }} jobs: