Luke Oliff.

TIL: Running GitHub Actions Locally With act

·TIL·1 min read·Luke Oliff

GitHub Actions workflows are YAML files. Testing them by pushing to a branch and waiting for the run is slow. act runs them locally in Docker.

act -j build

This reads your .github/workflows files and runs the build job in a container. The output matches what GitHub would produce, down to the log formatting.

act -l

List all available jobs across all workflow files. Pick one to run.

act --secret-file .env

Pass secrets from a local .env file so your workflow has access to the same variables it would on GitHub.

Does act support all GitHub Actions features?

Most of them. Self hosted runners, matrix strategies, and service containers all work. Some niche Actions with specific hardware requirements do not.

What Docker image does act use?

The default image varies by event. Use act -P ubuntu-latest=catthehacker/ubuntu:act-latest to match the GitHub runner environment.