Files
gitea-actions/claude/check-shared-block/README.md
T
2026-09-09 18:46:40 -04:00

45 lines
1.6 KiB
Markdown

# Check Shared CLAUDE.md Block
<!-- action-docs-description source="action.yml" -->
## Description
Fails when a repo's shared CLAUDE.md block has drifted from the canonical copy in stat-tackler-infra
<!-- action-docs-description source="action.yml" -->
<!-- action-docs-inputs source="action.yml" -->
## Inputs
| name | description | required | default |
| --- | --- | --- | --- |
| `TARGET` | <p>Path to the CLAUDE.md file to check</p> | `false` | `CLAUDE.md` |
| `CANONICAL_URL` | <p>Raw URL of the canonical shared fragment</p> | `false` | `https://gitea.pixelparasol.com/stat-tackler/stat-tackler-infra/raw/branch/main/docs/CLAUDE.shared.md` |
| `GITEA_TOKEN` | <p>Gitea token with read access to stat-tackler-infra, if it is private</p> | `false` | `""` |
<!-- action-docs-inputs source="action.yml" -->
<!-- action-docs-runs source="action.yml" -->
## Runs
This action is a `composite` action.
<!-- action-docs-runs source="action.yml" -->
## Running locally
The check logic has no dependency on the composite action wrapper beyond
`curl`, `awk`, and `diff` on `PATH`. From a repo's root:
```bash
CANONICAL_URL=https://gitea.pixelparasol.com/stat-tackler/stat-tackler-infra/raw/branch/main/docs/CLAUDE.shared.md \
TARGET=CLAUDE.md sh -c '
extract() { awk "/<!-- SHARED:BEGIN/{f=1} f{print} /SHARED:END -->/{f=0}" "$1"; }
tmp=$(mktemp)
curl -sfSL "$CANONICAL_URL" -o "$tmp"
extract "$tmp" > "$tmp.canon"
extract "$TARGET" > "$tmp.mine"
diff -u "$tmp.canon" "$tmp.mine" && echo "matches canonical"
rm -f "$tmp" "$tmp.canon" "$tmp.mine"
'
```
`GITEA_TOKEN` is only needed if `stat-tackler-infra` becomes private; it is
otherwise safe to omit.