This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Act is a tool to run GitHub Actions locally. It reads .github/workflows/ files, builds an execution plan, and uses Docker to run containers for each action. Written in Go 1.24+.
make buildβ build binary todist/local/actmake testβ rungo test ./...and the act CLImake lint-goβ rungolangci-lint runmake formatβ rungo fmt ./...make tidyβ rungo mod tidymake prβ full PR checklist: tidy, format-all, lint, testgo test ./pkg/runner/...β run tests for a single packagego test ./pkg/runner/ -run TestRunEventβ run a single test
- CLI (
cmd/root.go) β Cobra-based CLI parses flags into anInputstruct - Planner (
pkg/model/planner.go) β parses workflow YAML into aPlancontainingStages (serial) withRuns (parallel jobs) - Runner (
pkg/runner/runner.go) β converts the Plan into composableExecutorchains - RunContext (
pkg/runner/run_context.go) β holds all state for a job execution (env vars, matrix, containers, expressions) - Steps (
pkg/runner/step.go) β each step type (action, docker, script) implements thestepinterface
The Executor type (pkg/common/executor.go) is a func(ctx context.Context) error used throughout the codebase. Executors compose via:
.Then(),.Finally(),.OnError()β chainingNewPipelineExecutor()β serial executionNewParallelExecutor()β parallel execution.If(),.IfNot()β conditional execution
pkg/model/β workflow YAML parsing, plan creation, action definitionspkg/runner/β core execution engine, expression evaluation, step types (local/remote/docker/composite actions, reusable workflows)pkg/container/β Docker API wrapper, container and host execution environmentspkg/common/β Executor pattern, context utilities, loggingpkg/exprparser/β GitHub Actions${{ }}expression language interpreterpkg/artifacts/andpkg/artifactcache/β artifact upload/download and caching server
Configured in .golangci.yml:
- Use
errorsfrom stdlib, notg.iplcn2.com/pkg/errors - Use
github.com/sirupsen/logrus(aliased aslog), not stdliblog - Use
github.com/stretchr/testifyfor tests, notgotest.tools/v3 - Max cyclomatic complexity: 20
- Import aliases enforced:
logrusβlog,testify/assertβassert
- Tests use
testify/assertandtestify/mock - Table-driven tests are common in
pkg/model/andpkg/exprparser/ - Test fixtures live in
testdata/directories alongside their packages pkg/runner/testdata/contains extensive sample GitHub Actions workflows used as integration test fixtures