Skip to content

Commit 654c204

Browse files
committed
docs: add GitHub Action integration guide and document github output format
1 parent f6eac32 commit 654c204

2 files changed

Lines changed: 44 additions & 2 deletions

File tree

docs/ci-integration.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,48 @@ jobs:
8888
!!! note "Persisting baselines"
8989
The baseline is stored in `.pacta/snapshots/`. Commit this directory to your repository, or use GitHub Actions cache/artifacts to persist it between runs.
9090

91+
### Pacta GitHub Action (Recommended)
92+
93+
The simplest way to get rich architectural PR comments. Uses `--format github` to generate a descriptive Markdown comment with structural changes, violation details, and architecture trends:
94+
95+
```yaml
96+
name: Architecture Check
97+
98+
on:
99+
pull_request:
100+
branches: [main]
101+
102+
jobs:
103+
architecture:
104+
runs-on: ubuntu-latest
105+
permissions:
106+
pull-requests: write
107+
steps:
108+
- uses: actions/checkout@v4
109+
- uses: akhundMurad/pacta@main
110+
with:
111+
model: architecture.yml
112+
rules: rules.pacta.yml
113+
baseline: baseline
114+
```
115+
116+
The action will:
117+
118+
- Run `pacta scan` with `--format github` to produce a rich Markdown report
119+
- Post (or update) a PR comment with structural changes, new/fixed violations, and architecture trends
120+
- Fail the check if new violations are introduced (configurable via `fail-on-violations: false`)
121+
122+
**Action Inputs:**
123+
124+
| Input | Default | Description |
125+
|-------|---------|-------------|
126+
| `model` | `architecture.yml` | Path to architecture model |
127+
| `rules` | `rules.pacta.yml` | Path to rules file |
128+
| `baseline` | *(none)* | Baseline ref for incremental checks |
129+
| `python-version` | `3.11` | Python version |
130+
| `fail-on-violations` | `true` | Fail if new violations found |
131+
| `pacta-version` | `pacta` | Pacta package specifier |
132+
91133
### JSON Output for PR Comments
92134

93135
Generate JSON output and post results as a PR comment:

docs/cli.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pacta scan [PATH] [OPTIONS]
2020
|--------|---------|-------------|
2121
| `--model FILE` | `architecture.yml` | Architecture model file |
2222
| `--rules FILE` | `rules.pacta.yml` | Rules file (repeatable) |
23-
| `--format {text,json}` | `text` | Output format |
23+
| `--format {text,json,github}` | `text` | Output format (`github` produces Markdown for PR comments) |
2424
| `--baseline REF` | - | Compare against baseline snapshot |
2525
| `--save-ref REF` | - | Save snapshot under this ref |
2626
| `--mode {full,changed_only}` | `full` | Evaluation mode |
@@ -84,7 +84,7 @@ pacta check [PATH] [OPTIONS]
8484
| `--ref REF` | `latest` | Snapshot ref to check |
8585
| `--model FILE` | `architecture.yml` | Architecture model file |
8686
| `--rules FILE` | `rules.pacta.yml` | Rules file (repeatable) |
87-
| `--format {text,json}` | `text` | Output format |
87+
| `--format {text,json,github}` | `text` | Output format (`github` produces Markdown for PR comments) |
8888
| `--baseline REF` | - | Compare against baseline snapshot |
8989
| `--save-ref REF` | - | Also save result under this ref |
9090
| `-q, --quiet` | - | Summary only |

0 commit comments

Comments
 (0)