How nektos/act works
act is a local GitHub Actions runner. Its main workflow accepts CLI options, loads and plans repository workflows, evaluates job and step conditions, then executes actions in host or Docker environments. It also supports action/repository caching and GitHub artifact upload/download endpoints. The README documents Docker image preparation and dependency-based execution; sampled source shows CLI wiring and selected model, interpreter, container, and server behavior, but not every runtime handoff.
Main entry points: root.go Run Commands · run_context.go Run Context · workflow.go Workflow Model · main.go Command Entry
Components 20
CLI and Planning
- Command Entry
main.go - Run Commands
cmd/root.go - Workflow Files
Workflow Runtime
- Workflow Model
pkg/model/workflow.go - Job Planner
pkg/model/planner.go - GitHub Context
pkg/model/github_context.go - Expression Engine
pkg/exprparser/interpreter.go
Action Execution
- Job Runner
pkg/runner/runner.go - Run Context
pkg/runner/run_context.go - Action Runtime
pkg/runner/action.go - Step Runtime
pkg/runner/step_factory.go - Docker Environment
pkg/container/docker_run.go - Host Environment
pkg/container/host_environment.go
Local Services
- Artifact Server
pkg/artifacts/server.go - Artifact Cache API
pkg/artifactcache/handler.go - Cache Storage
pkg/artifactcache/storage.go
Repository Support
- Git Operations
pkg/common/git/git.go - Local Action Cache
pkg/runner/local_repository_cache.go
Other components
- CLI User
- Docker Engine
Connections 18
- CLI User → Command Entry: invokes
main.go - Command Entry → Run Commands: executes
main.go - Run Commands → Workflow Files: reads
- Run Commands → Workflow Model: loads
cmd/root.go - Workflow Model → Job Planner: plans
- Workflow Model → GitHub Context: builds context
- Run Context → Expression Engine: evaluates
pkg/runner/run_context.go - Job Runner → Run Context: runs jobs
- Run Context → Action Runtime: configures
pkg/runner/run_context.go - Action Runtime → Step Runtime: creates steps
- Run Context → Docker Environment: starts containers
pkg/runner/run_context.go - Docker Environment → Docker Engine: uses API
- Run Context → Host Environment: supports host runs
- GitHub Context → Git Operations: resolves refs
pkg/model/github_context.go - Local Action Cache → Git Operations: falls back to fetch
- Run Commands → Artifact Server: starts
cmd/root.go - Run Commands → Artifact Cache API: starts
cmd/root.go - Artifact Cache API → Cache Storage: persists cache