Rasmus Olsson

Running github actions locally

March 14, 2025

It’s pretty common for platform engineers and developers to push changes just to test their GitHub workflows. I’ve done it countless times myself, and honestly, it’s a hassle. You make a small tweak, then push to see if CI actually runs it. That feedback loop often takes several minutes.

Today we’re taking a quick look at the act CLI and how it can help us run GitHub Actions locally to speed up our feedback loops.

The act library is a small CLI tool that lets you run your GitHub Actions workflows locally on your own machine. It works by spinning up a Docker container that emulate the GitHub runner environment.

The docker image has various sizes, the higher the size the more tools and pre-installed dependencies it includes, making it closer to GitHub’s real runner environment It’s not guaranteed to run everything exactly the same, but it’s usually close enough to avoid lots of unnecessary pushes.

Running act for the first time requires choosing and downloading the image size:

  • Large size image: ~ 17GB download + 53.1GB storage, you will need 75GB of free disk space, snapshots of GitHub Hosted Runners without snap and pulled docker images
  • Medium size image: ~500MB, includes only necessary tools to bootstrap actions and aims to be compatible with most actions
  • Micro size image: <200MB, contains only NodeJS required to bootstrap actions, doesn't work with all actions

Let's test it out on a simple workflow, that just runs dotnet tests for a solution:

name: Demo .NET Workflow on: workflow_dispatch: jobs: demo-dotnet: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup .NET SDK uses: actions/setup-dotnet@v4 with: dotnet-version: "8.0.x" - name: Restore dependencies run: dotnet restore DemoApp.sln - name: Build the solution run: dotnet build DemoApp.sln --no-restore --configuration Release - name: Run tests run: dotnet test DemoApp.sln --no-build --configuration Release ... act -j demo-dotnet -W .github/workflows/demo-dotnet.yml --pull=false

output

Amazing..!

This is a simple example, but the idea is what matters. Hopefully, it will gain adoption over time, and fewer devs will brute-force their way through CI with commit histories like "retry", "retry 2", "now it will work!" and instead run GitHub Actions locally to catch the obvious issues first.

References:

Happy coding!

please share