From 375abb5b0189e1a7ef3444910396ab075ea16e5a Mon Sep 17 00:00:00 2001 From: Jorrit Wronski Date: Tue, 3 Nov 2026 11:48:17 +0000 Subject: [PATCH] CI: test branches through their pull request, not on every push too tests.yml ran on push to every branch and on pull_request, so each push to a branch with an open pull request ran the whole matrix twice (the branch head and the merge commit). The two runs use different refs, so they could not cancel each other. - push runs on master only; a branch is tested through its pull request, or by hand with workflow_dispatch. - One run per pull request at a time: a newer push cancels the run of the commit it replaces. Runs on master are never cancelled. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/tests.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 95f51e8..aa326fa 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,10 +1,22 @@ name: tests +# A branch is tested through its pull request, which runs on the merge +# commit GitHub prepares. Running on every push as well tested each commit +# twice. Pushes to master are still tested, and any other branch can be run +# by hand (Actions tab, "Run workflow"). on: push: - branches: ["**"] # every branch; a version tag runs these tests through release.yml instead + branches: [master] # a version tag runs these tests through release.yml instead pull_request: - workflow_call: # release.yml runs the whole workflow before it publishes + workflow_dispatch: + workflow_call: # release.yml runs the whole workflow before it publishes + +# One run per pull request at a time: a new push to a pull request cancels +# the run of the commit it replaces. Runs on master are never cancelled, +# so every merged commit keeps its result. +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} # The jobs only read the repository permissions: