Guides · Checked on 28 November 2026
How do I cut GitHub Actions costs on pull requests?
Group PR checks by workflow and pull request, then cancel the previous run when a new commit lands. The latest commit still gets the full suite; an older revision stops using a runner.
Cancel superseded runs per pull request
Pick a test workflow where results on old revisions are no longer needed. Leave deployment and merge-queue workflows alone.
Set
cancel-in-progress: trueon the workflow. Combine its unique name with the PR number in the concurrency group. Grouping by the target branch instead would put unrelated PRs tomainin the same group.
Tested on 28 November 2026
Two pushes to one PR produced the expected pair: GitHub cancelled the first run and the replacement passed in 9 seconds on checklane-2vcpu.
Show the workflow YAML
name: Cancel superseded PR tests
on:
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
test:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: checklane-2vcpu
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
with:
go-version-file: go.mod
cache: false
- run: go test ./...
Push twice to a test PR while the first run is still testing. Check that the older run is cancelled, the newer run finishes and a second PR can still run. Don’t count time the first run already used as savings.
On our own CI, newer pushes replaced 41 of 370 PR runs (11%) over eight days, 20–28 November 2026 UTC. We matched each cancelled run to a newer run of the same workflow on the same PR branch, created by the time cancellation was recorded or within 60 s after it.
Related guide: How can I reduce my GitHub Actions bill?
Frequently asked questions
Can expensive checks wait until a draft PR is ready for review?
Yes. Skip those jobs while github.event.pull_request.draft is true. Include ready_for_review alongside opened, reopened and synchronize in your pull_request trigger so marking a draft ready starts the checks without another push.
GitHub: pull request activity typesDo required checks need to run again in the merge queue?
Yes. Add merge_group to the workflow that reports the required checks. The queue needs a result for the merge group, so a passing pull_request run alone won’t let it merge.
GitHub: the merge_group eventWhy did the older run finish after I added a concurrency group?
By default a newer run replaces a pending run in the same group but lets the active one finish. Set cancel-in-progress to true to stop the active run too.
GitHub: workflow concurrencyRun this job on Checklane
If the remaining jobs are short, compare their total billed cost at Checklane’s per-second rate.
Connect your repository, then set the job’s runner label:
runs-on: checklane