GitHub Actions: Local Testing with act
act is a tool that runs GitHub Actions workflows on the reader's own laptop. It runs each job inside a local container, so a broken workflow is caught before it is pushed.
List the jobs
The list command shows each job and the event that triggers it.
act -lRun the push jobs
This command runs the jobs a push would trigger, on the laptop.
act pushRun the pull request jobs
This command runs the jobs a pull request would trigger, on the laptop.
act pull_requestExample
name: Local Test Demo
on: push
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: '24'
- run: npm testKey points
- act: a tool that runs workflows locally, made by nektos.
- Use act -l to list the jobs in a workflow file.
- Use act push to run the jobs that a push would trigger.
- Use act pull_request to run the jobs that a pull request would trigger.
- act needs Docker, since each job runs inside a local container.
- A container is a small sealed box that holds the tools a job needs.
- act is the local test that catches a broken workflow before a push.
In this example, the workflow is the same test workflow from earlier lessons. It checks out the code. It sets up Node 24. It runs npm test. act runs those steps inside a local container. The reader sees the result before pushing anything.
Try it Yourself
Edit the code, then press Run.
Running is simulated · Rust Playground
Exercise
What does act need on the laptop to run a workflow?