Skip to main content

CI & GitHub Action

know-code init --workflow

Writes .github/workflows/know-code.yml:

name: know-code

on:
pull_request:
push:
branches: [main]

jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: chtnnh/know-code/[email protected]
with:
base-branch: main

Composite action inputs

InputDefaultDescription
base-branchmainMust match local .know-code/config.json
require-allfalseStricter messaging when trailers missing
version^0.1.2npm pin for @chtnnh/know-code when not building from this monorepo

What verify checks

  1. Primary: HEAD commit message contains Know-Code-Verified: <current-hash>.
  2. Secondary: If HEAD is ahead of the base branch, scan trailers on that range only (not the entire repository history).

Use know-code commit -m "…" locally so the trailer is attached automatically.

Branch protection

After ci and know-code have run at least once:

node scripts/setup-branch-protection.mjs chtnnh/your-repo main

Requires gh with admin access. Mark know-code (and preferably ci) as required checks.

Overrides

KNOW_CODE_OVERRIDE=1 is local-only and is logged to .know-code/override.log. It never satisfies CI.