Skip to main content
charter check is designed for CI. It does not judge whether code semantically complies with a Decision. Instead, it guarantees that a matching accepted Decision was explicitly acknowledged.

How matching works

  1. Charter collects changed file names relative to the base ref using git diff <base>...HEAD.
  2. It considers accepted Decisions only.
  3. A Decision matches if a path glob matches a changed file, or if a scope tag appears in the unified diff.
  4. For each matching blocking Decision, Charter searches commit messages in <base>..HEAD for Governed-By: <id> or Charter: <id>.
  5. An uncited blocking match exits 2.

GitHub Actions example

Use a full Git history so the base commit and commit messages are available:
For an installed release binary, replace the last command with charter check --diff ....

Commit acknowledgments

Use one trailer per Decision:
Acknowledgments are assessed across the commit range, not only the latest commit. Keep the trailer on the commit that introduces the governed change so the project history stays understandable.

Local use versus CI

Without --diff, Charter compares the working tree with HEAD, reports matches, and does not block—there is no commit range whose trailers it can inspect. With --diff, it enforces blocking Decisions.

Interpret exit codes

If charter check cannot run at all — bad base ref, unreadable or corrupt decision store, missing .charter — it exits 3. Fail the job on it: it means “not checked”, never “passed”.

Practical CI guidance

  • Run the check on pull requests, not just after merge.
  • Pass a stable base SHA or branch reachable in the checkout.
  • Use fetch-depth: 0 for GitHub Actions; shallow history can prevent Charter from reading the range and commit trailers.
  • Keep scopes narrow enough that acknowledgments mean something.
  • Treat stale advisories as a review prompt, not a failed compliance check.