Files

Check Shared CLAUDE.md Block

Description

Fails when a repo's shared CLAUDE.md block has drifted from the canonical copy in stat-tackler-infra

Inputs

name description required default
TARGET

Path to the CLAUDE.md file to check

false CLAUDE.md
CANONICAL_URL

Raw URL of the canonical shared fragment

false https://gitea.pixelparasol.com/stat-tackler/stat-tackler-infra/raw/branch/main/docs/CLAUDE.shared.md
GITEA_TOKEN

Gitea token with read access to stat-tackler-infra, if it is private

false ""

Runs

This action is a composite action.

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:

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.