Skip to the content
Precision Soft
All projects

Git Audit

Go

A Go CLI that checks GitHub releases against CHANGELOG.md and keeps the release notes in sync. It works with public and private repositories, over HTTPS or SSH.

View on GitHubgo install github.com/precision-soft/git-audit@latest

Git Audit is a Go CLI that audits GitHub releases. It treats each repository's CHANGELOG.md as the source of truth and syncs the release bodies from it. For every tag it reports a status per level: integrity, distribution, changelog, diff and presentation. Accepted exceptions can carry an expiry date, and local clones are managed for you.

It works with any GitHub repository, public or private. The default project list is tuned for the precision-soft/* libraries, and anything else goes through --repo-url. It is built on Melody, our Go framework, and released under the MIT license.

Installation

Requirements: Go 1.26 or later, git on $PATH, and a GitHub token with Contents: Read & write on the target repositories. Private repositories are cloned with whatever SSH setup git clone git@github.com:... already uses.

go install github.com/precision-soft/git-audit@latest

Or build from source:

git clone https://github.com/precision-soft/git-audit
cd git-audit
go build -o git-audit .

Configuration

Parameters come from the .env / .env.local files next to the binary:

# .env.local (gitignored)
GITHUB_TOKEN=ghp_xxx
# optional: point the client at a proxy or a test double
GITHUB_API_BASE=https://api.github.com
GITHUB_RAW_BASE=https://raw.githubusercontent.com

Token precedence: the --token flag, then GITHUB_TOKEN. The token is registered as a secret parameter, so debug:parameters renders it as ********. Do not build with -tags melody_env_embedded from a checkout whose .env.local holds a real token: the tag embeds .env* into the binary.

Quick start

After go install, the Go binary directory must be on your PATH, and the .env.local above must sit next to the installed binary. After a source build, run ./git-audit from the checkout instead. Audit and sync a repository that is not in the built-in list, without adding it to the project configuration:

# Public repo, HTTPS
git-audit audit --repo my-lib --repo-url https://github.com/my-org/my-lib
git-audit sync  --repo my-lib --repo-url https://github.com/my-org/my-lib --apply
 
# Private repo, SSH
git-audit audit --repo secret-svc --repo-url git@github.com:my-org/secret-svc.git
git-audit sync  --repo secret-svc --repo-url git@github.com:my-org/secret-svc.git --apply

Ad-hoc repositories default to no Packagist check, a single CHANGELOG.md at the root, and no Go submodule filtering.

Commands

  • audit: cross-checks tags, GitHub releases, Packagist versions, changelog entries and commit diffs.
  • sync: pushes local CHANGELOG.md sections into the matching GitHub release body. Dry-run by default.
  • exceptions: lists accepted warnings from exceptions.json, grouped by project, with expiry status.

Audit rules

LevelRule
integrityTag and release are 1:1; the release is not a draft or prerelease; target_commitish matches the tag commit.
distributionPackagist has a version with a matching commit reference (skipped when there is no Packagist).
changelogThe entry exists, its heading matches ## [vX.Y.Z] - YYYY-MM-DD - <Title>, it has a compare link, its title matches the release title, and the release body overlaps the entry by at least 60%.
diffThe compare against the previous tag has at least one commit; non-trivial diffs must have release notes.
presentationThe title matches <Name> vX.Y.Z - <Summary>; only whitelisted ## sections.

Useful audit flags: --fail-on-warning exits 1 on warnings, not only on failures; --concurrency N audits 1 to 32 projects at a time (default 4); --github-annotations writes one ::warning / ::error workflow command per issue to stderr while stdout stays parseable with --format json; --cache-dir PATH caches GitHub responses by ETag. Opt-in supply-chain checks run with --supply-chain (signed-tags, checksums, sbom, attestations or all), reported as warnings unless --supply-chain-fail is set.

Sync

Without --apply, sync reports would-update per tag and prints a unified diff. For each ## [vX.Y.Z] section it extracts the entry body, normalises the headings, compares it against the current release body and, with --apply, patches the release.

Clones live under .dev-data/clones/<repo>/. A missing clone is cloned; an existing one is fetched and hard-reset to the default branch, then cleaned with git clean -fdx. Any local changes in those clones are discarded: they are scratch space, not a workspace.

Exceptions

Accepted warnings live in exceptions.json. An entry is either a plain issue string or an object with a reviewed_until date; expired entries are ignored by audit, so the warnings resurface:

{
    "precision-soft/doctrine-type": {
        "v1.0.0": {
            "presentation": [
                "title project name \"DoctrineType\" does not match expected \"Doctrine Type\"",
                {
                    "issue": "non-standard section: ## Notes",
                    "reviewed_until": "2026-07-01"
                }
            ]
        }
    }
}

Project manifests

For a persistent list, audit --config projects.json loads { "mode": "merge|replace", "projects": [...] } with the fields name, githubUrl, packagistUrl, goSubmodule and changelogPaths. merge keeps the built-in projects and overrides them by name; replace audits only the manifest. A misspelled key, a URL without an owner and a repository, a duplicate URL or a changelog path that escapes the repository is refused before anything is fetched.

The name is used by the presentation check (the release title must match <Name> vX.Y.Z - <Summary>); if omitted, it is derived from the repository slug. --repo also accepts a comma-separated list of repositories.

Documentation