From 1bc1d0699056b01002242dd9ccda3d3a186e38fc Mon Sep 17 00:00:00 2001 From: Nathaniel McCallum Date: Fri, 30 Oct 2026 09:15:20 -0400 Subject: [PATCH] ci: stop duplicate and outdated check runs A workflow is a file that tells GitHub which automatic checks to run and when. A branch is a named line of work in the repository, and the main branch is the shared branch that changes are merged into. A push means sending new commits up to GitHub. This workflow runs the checks for pull requests, for pushes to the main branch, and when someone starts it by hand. A push to any other branch does not start it, because the pull request for that branch already runs the same checks. GitHub lets a workflow give each run a group label, and only one run with the same label goes at a time. On the main branch, every run gets its own label, so no run there is ever stopped. Anywhere else, a newer run for the same pull request, or a newer run started by hand on the same branch, stops the older one. Fixes #3 --- .github/workflows/ci.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2751d54..a8bcc71 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,19 @@ name: CI on: + # Pull request branches get CI through pull_request, so they no longer run twice. push: + branches: [main] pull_request: workflow_dispatch: +# A newer push to the same pull request or branch cancels the older run. +# Each run on main gets its own group, so runs on main are never +# cancelled or dropped while waiting. +concurrency: + group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + env: CARGO_TERM_COLOR: always