diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index cec1ccc..2fa357e 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -7,9 +7,14 @@ on: branches: [main] workflow_dispatch: +# Only pull request runs share a group; every other run gets a group of its own +# (`github.run_id`), because a group holds at most one pending run and a later +# push would otherwise evict the one waiting. CodSpeed compares a pull request +# against the benchmark result of its base commit, so a `main` commit that never +# gets measured leaves later comparisons without a baseline. concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} permissions: contents: read diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 10024e0..e3d8606 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,6 +6,17 @@ on: pull_request: branches: [main] +# A new commit supersedes the previous one's jobs, so stop paying for them. +# Only pull request runs share a group; every other run gets a group of its own +# (`github.run_id`), because a group holds at most one pending run and a later +# push would otherwise evict the one waiting — `cancel-in-progress` protects the +# running run, not the queued one. `main` runs publish the coverage later +# comparisons are measured against, and losing one would also hide a breakage +# that is already on the default branch. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + permissions: contents: read # to fetch code (actions/checkout)