GitHub Actions: Cost and Free Minutes
Cost is what GitHub charges for running workflows. Public repos are free, and private repos on the Free plan get a small pool of money to spend on runs.
Skip runs for docs-only changes
A paths filter runs the workflow only when code files change.
on:
push:
paths:
- 'app.js'
- 'test/**'Cancel the old run
A new push cancels the old test run, so only the latest code is tested.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: trueCache the dependencies
Caching is saving downloaded files to reuse them next time. The setup action can cache npm files.
- uses: actions/setup-node@v7
with:
node-version: '24'
cache: npmExample
name: Cost Saving Demo
on:
push:
paths:
- 'app.js'
- 'test/**'
jobs:
test:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '24'
cache: npm
- run: npm testKey points
- Public repos are free, so their workflow runs cost nothing.
- Private repos on the Free plan get a $12 pool since October 2026.
- Use paths filters to skip runs when only docs change.
- Use concurrency cancel to stop old runs when a new push arrives.
- Use caching to skip downloading the same files on every run.
- Check the usage meter in the repo settings to see what runs cost.
- Keeping runs cheap is a habit of skipping runs that add nothing.
In this example, the workflow runs on push, but only when app.js or a test file changes. A docs-only change starts no run. The job uses a concurrency group that cancels the old run on a new push. The setup step caches npm files, so they are not downloaded again. Each saving cuts the number of runs, or the time each run takes.
Try it Yourself
Edit the code, then press Run.
Running is simulated · Rust Playground
Exercise
A commit changes only the README file. What is the cheapest result?