# aquasecurity/trivy-action architecture

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

- Interactive diagram: https://gitdiagram.com/aquasecurity/trivy-action
- Repository: https://github.com/aquasecurity/trivy-action

## Overview

Trivy Action adapts a GitHub Actions invocation into a Trivy scan: users select a scan type and target, the action arranges Trivy setup and optional cache handling, and Trivy produces scan output. The README documents image, filesystem, repository, rootfs, IaC, tarball, SBOM, template, and private-registry use cases, plus SARIF for GitHub Code Scanning. Source excerpts were unavailable, so the graph captures documented relationships only; it does not infer how entrypoint.sh implements them.

Main entry points: [`action.yaml`](https://github.com/aquasecurity/trivy-action/blob/master/action.yaml) (Trivy Action)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_action["Action orchestration"]
  node_action["Trivy Action<br/>[action.yaml]"]
  node_entrypoint["Action entrypoint<br/>[entrypoint.sh]"]
  node_setup["Trivy setup"]
end

subgraph group_scanning["Trivy scanning"]
  node_scanner["Trivy scanner"]
  node_targets["Scan targets"]
  node_results["Scan results"]
end

subgraph group_cache["Cache management"]
  node_cache_service[("Actions cache")]
end

node_user(("Workflow author"))

node_user -->|"configures"| node_action
node_action -->|"sets up"| node_setup
node_action -->|"restores cache"| node_cache_service
node_action -->|"runs scan"| node_scanner
node_scanner -->|"scans"| node_targets
node_scanner -->|"produces"| node_results
node_action -->|"saves cache"| node_cache_service

click node_action "https://github.com/aquasecurity/trivy-action/blob/master/action.yaml"
click node_entrypoint "https://github.com/aquasecurity/trivy-action/blob/master/entrypoint.sh"

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_action,node_entrypoint,node_setup toneBlue
class node_scanner,node_targets,node_results toneAmber
class node_cache_service toneMint
class node_user toneIndigo
```

## Components

### Action orchestration

- [Trivy Action](https://github.com/aquasecurity/trivy-action/blob/master/action.yaml): `action.yaml`
- [Action entrypoint](https://github.com/aquasecurity/trivy-action/blob/master/entrypoint.sh): `entrypoint.sh`
- **Trivy setup**

### Trivy scanning

- **Trivy scanner**
- **Scan targets**
- **Scan results**

### Cache management

- **Actions cache**

### Other components

- **Workflow author**

## Connections

- Workflow author → Trivy Action: configures (evidence: `README.md`)
- Trivy Action → Trivy setup: sets up (evidence: `README.md`)
- Trivy Action → Actions cache: restores cache (evidence: `README.md`)
- Trivy Action → Trivy scanner: runs scan (evidence: `README.md`)
- Trivy scanner → Scan targets: scans (evidence: `README.md`)
- Trivy scanner → Scan results: produces (evidence: `README.md`)
- Trivy Action → Actions cache: saves cache (evidence: `README.md`)
