| name | act-local-ci |
| description | Run and debug GitHub Actions workflows locally using the `act` CLI tool. Covers runner image selection, secrets/vars handling, job targeting, event simulation, and common troubleshooting patterns.
TRIGGER THIS SKILL WHEN: - Running or testing GitHub Actions workflows locally - Debugging CI/CD pipeline failures without pushing to GitHub - Validating workflow file changes before committing - Simulating different GitHub events (push, pull_request, workflow_dispatch) - Troubleshooting act runner image issues or missing tools
SYMPTOMS THAT TRIGGER THIS SKILL: - Agent pushes workflow changes to test them instead of running locally - Agent doesn't know how to provide secrets or vars to local workflow runs - Agent can't reproduce a CI failure locally - Agent needs to run a specific job or workflow in isolation
|
| metadata | {"version":"1.0.0"} |
Running GitHub Actions Locally with act
act reads .github/workflows/ and runs them in Docker containers that simulate GitHub-hosted runners. Use it for fast feedback without commit/push cycles.
Quick Reference
act
act push
act pull_request
act workflow_dispatch
act -l
act -l pull_request
act -W .github/workflows/validate-infrastructure.yml
act -j validate-docker
act -n
act -v
Runner Images
act maps runs-on values to Docker images. Default images are intentionally minimal — they do NOT contain all tools GitHub provides.
Image Tiers
| Runner Label | Micro (default) | Medium | Large (full GitHub parity) |
|---|
ubuntu-latest | node:16-buster-slim | catthehacker/ubuntu:act-latest | catthehacker/ubuntu:full-latest |
ubuntu-22.04 | node:16-bullseye-slim | catthehacker/ubuntu:act-22.04 | catthehacker/ubuntu:full-22.04 |
ubuntu-20.04 | node:16-buster-slim | catthehacker/ubuntu:act-20.04 | catthehacker/ubuntu:full-20.04 |
Selecting a Runner Image
Use -P to override the image for a platform:
act -P ubuntu-latest=catthehacker/ubuntu:act-latest
act -P ubuntu-latest=catthehacker/ubuntu:full-latest
act -P ubuntu-latest=-self-hosted
act -P ubuntu-latest=catthehacker/ubuntu:act-latest \
-P ubuntu-22.04=catthehacker/ubuntu:act-22.04
When to Use Each Tier
- Micro (default): Simple workflows with basic shell commands, no special tooling needed.
- Medium (
act-*): Workflows that need common tools (Python, Node, Docker CLI, Helm, etc.). Best default for most projects.
- Large (
full-*): Workflows that fail on medium due to missing tools. Closest to GitHub but very large download.
- Self-hosted (
-self-hosted): When you need exact host-OS tools or can't use Docker-in-Docker.
Secrets and Variables
Secrets
act -s MY_SECRET=some-value
act -s MY_SECRET
act --secret-file .secrets
act -s GITHUB_TOKEN="$(gh auth token)"
Repository Variables
act --var MY_VAR=some-value
act --var-file .vars
Environment Variables
act --env MY_ENV=foo
act --env-file my.env
Event Simulation
Event Types
act push
act pull_request
act schedule
act workflow_dispatch
Event Payloads
Create a JSON file to provide event properties workflows expect:
{
"pull_request": {
"head": { "ref": "feature-branch" },
"base": { "ref": "main" }
}
}
{
"inputs": {
"environment": "staging",
"dry_run": "true"
}
}
act pull_request -e pr-event.json
act workflow_dispatch -e dispatch-event.json
Workflow Dispatch Inputs
act workflow_dispatch --input NAME=value --input OTHER=value
act workflow_dispatch --input-file .input
Matrix Targeting
Run only specific matrix combinations:
act --matrix node:18
act --matrix node:18 --matrix os:ubuntu-latest
Performance and Caching
Offline Mode
Speeds up repeated runs by caching actions and images:
act --action-offline-mode
Skip Image Pulls
act --pull=false
Reuse Containers
Keep containers between runs to preserve state:
act -r
Artifacts
Enable artifact upload/download support:
act --artifact-server-path ./.artifacts
Configuration File
Create .actrc in the repo root for persistent defaults (one arg per line):
--container-architecture=linux/amd64
--action-offline-mode
-P ubuntu-latest=catthehacker/ubuntu:act-latest
Files are loaded in order: XDG config → $HOME/.actrc → project .actrc → CLI args.
Skipping Jobs/Steps Locally
Skip a job when running locally
jobs:
deploy:
if: ${{ !github.event.act }}
runs-on: ubuntu-latest
Provide an event file to trigger the skip:
{ "act": true }
act -e event.json
Skip a step when running locally
- name: Post to Slack
if: ${{ !env.ACT }}
run: echo "Only runs on GitHub"
The ACT environment variable is automatically set by act.
Troubleshooting
Common Issues
| Problem | Solution |
|---|
| Action fails with "token" error | Pass -s GITHUB_TOKEN="$(gh auth token)" |
| Missing tools in runner | Use medium image: -P ubuntu-latest=catthehacker/ubuntu:act-latest |
| Docker-in-Docker not working | Use --privileged flag or self-hosted runner |
| systemd not available | Known limitation — Docker containers don't support systemd |
| Slow first run | Images are large; subsequent runs use cache. Use --action-offline-mode |
| Actions re-downloaded every run | Enable --action-offline-mode or --pull=false |
| Need to bind mount working dir | Use -b / --bind instead of copy |
| Container architecture mismatch | Set --container-architecture=linux/amd64 |
| Workflow uses Windows/macOS runner | Use -P windows-latest=-self-hosted (must be on matching OS) |
Debugging Workflow
act -n
act -l
act -j my-job -v
act -j my-job -P ubuntu-latest=catthehacker/ubuntu:act-latest
act -j my-job -P ubuntu-latest=catthehacker/ubuntu:full-latest
act -j my-job --privileged -P ubuntu-latest=catthehacker/ubuntu:act-latest
Custom Container Engine
Use Podman or remote Docker:
DOCKER_HOST='unix:///var/run/podman/podman.sock' act
DOCKER_HOST='ssh://user@host' act
Project-Specific Examples
Running lucia-dotnet Workflows
act -W .github/workflows/validate-infrastructure.yml \
-P ubuntu-latest=catthehacker/ubuntu:act-latest
act -W .github/workflows/helm-lint.yml \
-P ubuntu-latest=catthehacker/ubuntu:act-latest
act -W .github/workflows/docker-build-push.yml \
-j build-and-push \
--privileged \
-P ubuntu-latest=catthehacker/ubuntu:act-latest \
-s DOCKER_HUB_USERNAME=your-username \
-s DOCKER_HUB_TOKEN=your-token
act -j validate-kubernetes \
-W .github/workflows/validate-infrastructure.yml \
-P ubuntu-latest=catthehacker/ubuntu:act-latest
act -n -W .github/workflows/validate-infrastructure.yml