# nektos/act architecture

> Architecture diagram of the GitHub repository nektos/act, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nektos/act
- Repository: https://github.com/nektos/act

## Overview

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: [`cmd/root.go`](https://github.com/nektos/act/blob/main/cmd/root.go) (Run Commands), [`pkg/runner/run_context.go`](https://github.com/nektos/act/blob/main/pkg/runner/run_context.go) (Run Context), [`pkg/model/workflow.go`](https://github.com/nektos/act/blob/main/pkg/model/workflow.go) (Workflow Model), [`main.go`](https://github.com/nektos/act/blob/main/main.go) (Command Entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and Planning"]
  node_entry["Command Entry<br/>[main.go]"]
  node_commands["Run Commands<br/>[root.go]"]
  node_workflowfiles["Workflow Files"]
end

subgraph group_workflow["Workflow Runtime"]
  node_workflowmodel["Workflow Model<br/>[workflow.go]"]
  node_planner["Job Planner<br/>[planner.go]"]
  node_githubcontext["GitHub Context<br/>[github_context.go]"]
  node_expressions["Expression Engine<br/>[interpreter.go]"]
end

subgraph group_execution["Action Execution"]
  node_runner["Job Runner<br/>[runner.go]"]
  node_runcontext["Run Context<br/>[run_context.go]"]
  node_actions["Action Runtime<br/>[action.go]"]
  node_steps["Step Runtime<br/>[step_factory.go]"]
  node_docker["Docker Environment<br/>[docker_run.go]"]
  node_host["Host Environment"]
end

subgraph group_services["Local Services"]
  node_artifactserver["Artifact Server<br/>[server.go]"]
  node_artifactcache["Artifact Cache API<br/>[handler.go]"]
  node_cachedata[("Cache Storage<br/>[storage.go]")]
end

subgraph group_support["Repository Support"]
  node_git["Git Operations<br/>[git.go]"]
  node_localcache["Local Action Cache"]
end

node_user(("CLI User"))
node_dockerengine(("Docker Engine"))

node_user -->|"invokes"| node_entry
node_entry -->|"executes"| node_commands
node_commands -->|"reads"| node_workflowfiles
node_commands -->|"loads"| node_workflowmodel
node_workflowmodel -.->|"plans"| node_planner
node_workflowmodel -.->|"builds context"| node_githubcontext
node_runcontext -->|"evaluates"| node_expressions
node_runner -.->|"runs jobs"| node_runcontext
node_runcontext -->|"configures"| node_actions
node_actions -.->|"creates steps"| node_steps
node_runcontext -->|"starts containers"| node_docker
node_docker -->|"uses API"| node_dockerengine
node_runcontext -.->|"supports host runs"| node_host
node_githubcontext -->|"resolves refs"| node_git
node_localcache -.->|"falls back to fetch"| node_git
node_commands -->|"starts"| node_artifactserver
node_commands -->|"starts"| node_artifactcache
node_artifactcache -.->|"persists cache"| node_cachedata

click node_entry "https://github.com/nektos/act/blob/main/main.go"
click node_commands "https://github.com/nektos/act/blob/main/cmd/root.go"
click node_workflowmodel "https://github.com/nektos/act/blob/main/pkg/model/workflow.go"
click node_planner "https://github.com/nektos/act/blob/main/pkg/model/planner.go"
click node_githubcontext "https://github.com/nektos/act/blob/main/pkg/model/github_context.go"
click node_expressions "https://github.com/nektos/act/blob/main/pkg/exprparser/interpreter.go"
click node_runner "https://github.com/nektos/act/blob/main/pkg/runner/runner.go"
click node_runcontext "https://github.com/nektos/act/blob/main/pkg/runner/run_context.go"
click node_actions "https://github.com/nektos/act/blob/main/pkg/runner/action.go"
click node_steps "https://github.com/nektos/act/blob/main/pkg/runner/step_factory.go"
click node_docker "https://github.com/nektos/act/blob/main/pkg/container/docker_run.go"
click node_host "https://github.com/nektos/act/blob/main/pkg/container/host_environment.go"
click node_git "https://github.com/nektos/act/blob/main/pkg/common/git/git.go"
click node_localcache "https://github.com/nektos/act/blob/main/pkg/runner/local_repository_cache.go"
click node_artifactserver "https://github.com/nektos/act/blob/main/pkg/artifacts/server.go"
click node_artifactcache "https://github.com/nektos/act/blob/main/pkg/artifactcache/handler.go"
click node_cachedata "https://github.com/nektos/act/blob/main/pkg/artifactcache/storage.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_commands,node_workflowfiles,node_user toneBlue
class node_workflowmodel,node_planner,node_githubcontext,node_expressions toneAmber
class node_runner,node_runcontext,node_actions,node_steps,node_docker,node_host toneMint
class node_artifactserver,node_artifactcache,node_cachedata toneRose
class node_git,node_localcache,node_dockerengine toneIndigo
```

## Components

### CLI and Planning

- [Command Entry](https://github.com/nektos/act/blob/main/main.go): `main.go`
- [Run Commands](https://github.com/nektos/act/blob/main/cmd/root.go): `cmd/root.go`
- **Workflow Files**

### Workflow Runtime

- [Workflow Model](https://github.com/nektos/act/blob/main/pkg/model/workflow.go): `pkg/model/workflow.go`
- [Job Planner](https://github.com/nektos/act/blob/main/pkg/model/planner.go): `pkg/model/planner.go`
- [GitHub Context](https://github.com/nektos/act/blob/main/pkg/model/github_context.go): `pkg/model/github_context.go`
- [Expression Engine](https://github.com/nektos/act/blob/main/pkg/exprparser/interpreter.go): `pkg/exprparser/interpreter.go`

### Action Execution

- [Job Runner](https://github.com/nektos/act/blob/main/pkg/runner/runner.go): `pkg/runner/runner.go`
- [Run Context](https://github.com/nektos/act/blob/main/pkg/runner/run_context.go): `pkg/runner/run_context.go`
- [Action Runtime](https://github.com/nektos/act/blob/main/pkg/runner/action.go): `pkg/runner/action.go`
- [Step Runtime](https://github.com/nektos/act/blob/main/pkg/runner/step_factory.go): `pkg/runner/step_factory.go`
- [Docker Environment](https://github.com/nektos/act/blob/main/pkg/container/docker_run.go): `pkg/container/docker_run.go`
- [Host Environment](https://github.com/nektos/act/blob/main/pkg/container/host_environment.go): `pkg/container/host_environment.go`

### Local Services

- [Artifact Server](https://github.com/nektos/act/blob/main/pkg/artifacts/server.go): `pkg/artifacts/server.go`
- [Artifact Cache API](https://github.com/nektos/act/blob/main/pkg/artifactcache/handler.go): `pkg/artifactcache/handler.go`
- [Cache Storage](https://github.com/nektos/act/blob/main/pkg/artifactcache/storage.go): `pkg/artifactcache/storage.go`

### Repository Support

- [Git Operations](https://github.com/nektos/act/blob/main/pkg/common/git/git.go): `pkg/common/git/git.go`
- [Local Action Cache](https://github.com/nektos/act/blob/main/pkg/runner/local_repository_cache.go): `pkg/runner/local_repository_cache.go`

### Other components

- **CLI User**
- **Docker Engine**

## Connections

- CLI User → Command Entry: invokes (evidence: `main.go`)
- Command Entry → Run Commands: executes (evidence: `main.go`)
- Run Commands → Workflow Files: reads
- Run Commands → Workflow Model: loads (evidence: `cmd/root.go`)
- Workflow Model → Job Planner: plans
- Workflow Model → GitHub Context: builds context
- Run Context → Expression Engine: evaluates (evidence: `pkg/runner/run_context.go`)
- Job Runner → Run Context: runs jobs
- Run Context → Action Runtime: configures (evidence: `pkg/runner/run_context.go`)
- Action Runtime → Step Runtime: creates steps
- Run Context → Docker Environment: starts containers (evidence: `pkg/runner/run_context.go`)
- Docker Environment → Docker Engine: uses API
- Run Context → Host Environment: supports host runs
- GitHub Context → Git Operations: resolves refs (evidence: `pkg/model/github_context.go`)
- Local Action Cache → Git Operations: falls back to fetch
- Run Commands → Artifact Server: starts (evidence: `cmd/root.go`)
- Run Commands → Artifact Cache API: starts (evidence: `cmd/root.go`)
- Artifact Cache API → Cache Storage: persists cache
