Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
$ als gewone gebruiker# als root (of met sudo)
The quick answer
Step by step
- Install act (a single binary; see its releases or your package manager) and have Docker running.
- List the jobs (line 1) — shows each workflow, job and the events that trigger it.
- Run one job (line 2) —
act EVENT -j JOB. Without-jall jobs for that event run. The first run asks which runner image size to use: Save the choice or set it:act -P ubuntu-latest=catthehacker/ubuntu:act-latest.- micro — tiny, many tools missing;
- medium (
catthehacker/ubuntu:act-latest) — good default; - large — close to GitHub's image, but many GB.
- Secrets and variables (line 3) — put test values in files that are **in
.gitignore**:
REGISTRY_TOKEN=test-token-not-realNever use production secrets locally.
- Event data — test a workflow that reads the PR or tag:
{ "pull_request": { "head": { "ref": "feature/login" }, "base": { "ref": "main" } } }act pull_request -e event.json -j test- Fast feedback loop —
act -j test --reusekeeps the container between runs;--dryrun(-n) only shows what would run. - Know the limits — no real
GITHUB_TOKENpermissions, OIDC to clouds does not work, services and caches behave differently, macOS/Windows runners cannot run. Use act for logic and scripts; the final check is still a real run on GitHub. - Lint too —
actionlintfinds syntax and expression errors in seconds, before any run.
Check that it worked
act -l lists your jobs; act pull_request -j test ends with Job succeeded for a working job and shows the same error as GitHub for a broken one; after the fix the real GitHub run is green on the first try.
Common problems
| Problem | Cause | Fix |
|---|---|---|
command not found inside the job | Micro image without that tool. | Medium or large image (-P). |
Cannot connect to the Docker daemon | Docker not running or no rights. | Start Docker; add your user to the docker group. |
Step using OIDC or GITHUB_TOKEN fails | Not available locally. | Skip that step locally (if: ${{ !env.ACT }}). |
| Secrets committed by mistake | .secrets not ignored. | Add it to .gitignore; rotate the secret. |
| Different result than on GitHub | Different image or tool versions. | Use the large image for that test; final run on GitHub. |
| ARM Mac errors | Images built for amd64. | --container-architecture linux/amd64. |
Go further
- Command pages: act, gh, docker.
- Next how-tos: Create a CI pipeline in GitHub Actions, Reuse workflows in GitHub Actions, Use secrets safely in GitHub Actions, Test on many versions with a CI matrix.
- Learn it: GitHub Actions — Workflow parts, Delivery tools at work — act.
1Why use act?
It runs workflows locally in Docker, so you can test changes in seconds instead of pushing and waiting.
2What does act not replace?
Real GitHub features such as GITHUB_TOKEN permissions and OIDC; the final check is still a run on GitHub.