OXYGENHUB
◆ main oxygen / scripts / changelog-check.sh
1.4 KiB · Bourne Again Shell (bash) · executable · last changed Changelog per change: a check in the gate, and Unreleased caught up 16 days ago source blame history raw
1
#!/bin/sh
2
# The changelog check (2026-10-19): a commit that changes what users get
3
# adds a line under "## Unreleased" in CHANGELOG.md, so a release's notes
4
# are written as the work is done and versions say what changed.
5
#
6
#   scripts/changelog-check.sh [PATH...]
7
#
8
# PATHs are what the commit will take (as given to `oxy commit`); without
9
# any, the working copy's changes. Code is anything under src/, crates/,
10
# templates/, assets/, packaging/, images/ or scripts/, except tests.
11
# Docs, pipelines, pins (deps/) and lock files need no line. For a code
12
# change users won't notice (a refactor, a test helper), set NO_CHANGELOG=1.
13
set -eu
14
[ "${NO_CHANGELOG:-}" = 1 ] && exit 0
15
cd "$(dirname "$0")/.."
16
if [ "$#" -gt 0 ]; then
17
    paths=$(printf '%s\n' "$@")
18
else
19
    paths=$(oxy --plain status --json | python3 -c 'import json,sys; print("\n".join(p["path"] for p in json.load(sys.stdin)["paths"]))')
20
fi
21
code=$(printf '%s\n' "$paths" | grep -E '^(src|crates|templates|assets|packaging|images|scripts)/' | grep -vE '(^|/)tests?/|_test\.rs$' || true)
22
[ -z "$code" ] && exit 0
23
printf '%s\n' "$paths" | grep -qx 'CHANGELOG.md' && exit 0
24
echo "changelog: these changes touch code but CHANGELOG.md has no new line under ## Unreleased:" >&2
25
printf '%s\n' "$code" | sed 's/^/  /' >&2
26
echo "add one (Added / Changed / Fixed / Security, with the issue number), or set NO_CHANGELOG=1 if users won't notice" >&2
27
exit 1