GitHub Action
The action analyses the base and head of each pull request, uploads the map and the report as an artifact and leaves a comment with the architecture diff. Today it is used through a subpath of the monorepo.
.github/workflows/codarch.yml:
name: CodArchon: pull_requestpermissions: contents: read pull-requests: writejobs: codarch: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 with: { fetch-depth: 0 } - uses: jaminsmoke/codarch/apps/github-action@v1 with: github-token: ${{ secrets.GITHUB_TOKEN }} fail-on: nonefetch-depth: 0is required: the base is computed from the merge-base and analysed in agit worktree.- The action installs
codarchfrom npm; it does not need CodArch’s code nor runnpm cion your project. The version is pinned withversion.
What it produces
Section titled “What it produces”- One comment, updated: it carries the
<!-- codarch-report -->marker; each push edits the same comment instead of creating another. - An artifact (
codarch): the base and head snapshots, the head map,report.jsonand the capturehead/map.pngwith its summary inhead/map.json.
The comment links that capture and writes what the PNG does not say: which area and colour it is painted with, the scale and the five largest cells. The image cannot be embedded in a comment —GitHub drops the ones without a URL—, so it lives in the artifact.
Warn or block
Section titled “Warn or block”fail-on | Blocks when |
|---|---|
none (default) | never: it comments and uploads the artifact |
violations | there are new .codarch.yml violations |
cycles | new cycles appear |
hotspots | new hotspots appear |
any | any of the above |
Only what the PR introduces blocks. Exit code 2: policy broken; 1: analysis or configuration
error. Each rule’s severity (info/warn/error) is decided in .codarch.yml.
Inputs
Section titled “Inputs”github-token, base-ref, base-sha, fail-on, config (default .codarch.yml; none disables
it), comment, artifact-name, node-version, version, working-directory, title and top. The
full list with defaults is in apps/github-action/action.yml.
On PRs from forks the token is usually read-only: the comment is skipped with a warning, but the analysis and the artifact still work.