#!/bin/sh # The changelog check (2026-10-19): a commit that changes what users get # adds a line under "## Unreleased" in CHANGELOG.md, so a release's notes # are written as the work is done and versions say what changed. # # scripts/changelog-check.sh [PATH...] # # PATHs are what the commit will take (as given to `oxy commit`); without # any, the working copy's changes. Code is anything under src/, crates/, # templates/, assets/, packaging/, images/ or scripts/, except tests. # Docs, pipelines, pins (deps/) and lock files need no line. For a code # change users won't notice (a refactor, a test helper), set NO_CHANGELOG=1. set -eu [ "${NO_CHANGELOG:-}" = 1 ] && exit 0 cd "$(dirname "$0")/.." if [ "$#" -gt 0 ]; then paths=$(printf '%s\n' "$@") else paths=$(oxy --plain status --json | python3 -c 'import json,sys; print("\n".join(p["path"] for p in json.load(sys.stdin)["paths"]))') fi code=$(printf '%s\n' "$paths" | grep -E '^(src|crates|templates|assets|packaging|images|scripts)/' | grep -vE '(^|/)tests?/|_test\.rs$' || true) [ -z "$code" ] && exit 0 printf '%s\n' "$paths" | grep -qx 'CHANGELOG.md' && exit 0 echo "changelog: these changes touch code but CHANGELOG.md has no new line under ## Unreleased:" >&2 printf '%s\n' "$code" | sed 's/^/ /' >&2 echo "add one (Added / Changed / Fixed / Security, with the issue number), or set NO_CHANGELOG=1 if users won't notice" >&2 exit 1