mirror of
https://github.com/piabrota/mu.git
synced 2026-11-07 06:15:59 -10:00
* Base CI: markdownlint bends for the house style, with reasons (base-ci-T001) Co-Authored-By: Claude Sonnet 5.5 <[email protected]> * Base CI: exclusion tests prove the shared bends still load (base-ci-T001 fix) Co-Authored-By: Claude Sonnet 5.5 <[email protected]> * add-ci.sh: --upgrade replaces the known gitleaks-only config (base-ci-T002) Co-Authored-By: Claude Sonnet 5.5 <[email protected]> * md-same-text.sh: prove a Markdown change is formatting only (base-ci-T003) Co-Authored-By: Claude Sonnet 5.5 <[email protected]> * md-same-text.sh: compare link targets and indented code (base-ci-T003 fix) Co-Authored-By: Claude Sonnet 5.5 <[email protected]> * rollout-ci.sh: push and protect the base CI on existing repos (base-ci-T004) Co-Authored-By: Claude Opus 5.5 <[email protected]> * rollout-ci.sh: lease on the last push, leave merged repos alone (base-ci-T004 fix) Co-Authored-By: Claude Opus 5.5 <[email protected]> * md-same-text: an autolink is not a link change (base-ci tooling review) Co-Authored-By: Claude Opus 5.5 <[email protected]> * md-same-text: raw HTML is part of the compared text (base-ci tooling review) Co-Authored-By: Claude Opus 5.5 <[email protected]> * md-same-text: an added markdownlint-disable comment differs (base-ci tooling review) Co-Authored-By: Claude Opus 5.5 <[email protected]> * rollout-ci.sh: accept .github as a repo name (base-ci tooling review) Co-Authored-By: Claude Opus 5.5 <[email protected]> * rollout-ci.sh: a global insteadOf can't route around the token (base-ci tooling review) Co-Authored-By: Claude Opus 5.5 <[email protected]> * rollout-ci.sh: push in another org needs ROLLOUT_BOT (base-ci tooling review) Co-Authored-By: Claude Opus 5.5 <[email protected]> * Base CI: the shell piece ships .shellcheckrc with external-sources (base-ci tooling review) Co-Authored-By: Claude Opus 5.5 <[email protected]> * Base CI README: the rollout branch passes gitleaks-history too (base-ci tooling review) Co-Authored-By: Claude Opus 5.5 <[email protected]> * lint-config test: a comment no longer reads as a shellcheck directive (base-ci tooling review) Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Bruno Guilhermo de Barros Valério <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
31 lines
1.9 KiB
Bash
Executable File
31 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Prove that a Markdown change is formatting only. An agent runs it after `markdownlint-cli2 --fix`.
|
|
# md-same-text.sh <base-ref> <head-ref> run inside a git repo; it reads only, and needs no token
|
|
# For each .md file changed between the refs it prints `same <file>` or `DIFFERS <file>: <why>`:
|
|
# lintoff a markdownlint-disable or markdownlint-configure-file comment was added
|
|
# text the rendered text differs (whitespace and Markdown markup are ignored; raw HTML counts as text)
|
|
# code a code block (fenced or indented) differs by any byte, even a tab or a trailing space
|
|
# links a link or image target differs (including href= and src= in raw HTML)
|
|
# added / deleted the file exists in only one ref
|
|
# Exit 0 if every file is the same or no .md file changed, 1 if any differs, 2 on bad input.
|
|
# The renderer is md-same-text.py, with markdown-it-py pinned, run by uvx as `python3 -I`.
|
|
set -euo pipefail
|
|
die() { echo "md-same-text.sh: $*" >&2; exit 2; }
|
|
[ $# -eq 2 ] || die "usage: md-same-text.sh <base-ref> <head-ref>"
|
|
git rev-parse --git-dir >/dev/null 2>&1 || die "not inside a git repo"
|
|
for r in "$1" "$2"; do git rev-parse --verify --quiet "$r^{commit}" >/dev/null || die "bad ref: $r"; done
|
|
PY="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/md-same-text.py"
|
|
T="$(mktemp -d)"
|
|
trap 'rm -rf -- "$T"' EXIT
|
|
fail=0
|
|
diff_names() { git diff -z --no-renames --name-only --diff-filter="$1" "$2" "$3" -- '*.md'; }
|
|
while IFS= read -r -d '' f; do echo "DIFFERS $f: added"; fail=1; done < <(diff_names A "$1" "$2")
|
|
while IFS= read -r -d '' f; do echo "DIFFERS $f: deleted"; fail=1; done < <(diff_names D "$1" "$2")
|
|
while IFS= read -r -d '' f; do
|
|
git show "$1:$f" >"$T/old.md"
|
|
git show "$2:$f" >"$T/new.md"
|
|
v="$(uvx -q --with 'markdown-it-py==3.0.0' python3 -I "$PY" "$T/old.md" "$T/new.md")"
|
|
if [ "$v" = same ]; then echo "same $f"; else echo "DIFFERS $f: $v"; fail=1; fi
|
|
done < <(diff_names M "$1" "$2")
|
|
exit $fail
|