diff --git a/doc/Makefile b/doc/Makefile index 4f6d4aab7a8f..84bb63c3b3cc 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -227,22 +227,22 @@ doc/index.rst: $(MANPAGES:=.md) python3 devtools/blockreplace.py doc/index.rst manpages --language=rst --indent " " \ ) -# For CI to (very roughly!) check that we only deprecated fields, or labelled added ones -# When running on GitHub (CI=true), we need to fetch origin/master +# Overridden by GH CI if necessary. +BASE_REF=master schema-added-check: - @if ! test -z $$CI; then git fetch origin master; fi; \ - if git diff origin/master -- doc/schemas | grep -q '^+.*{' && ! git diff origin/master -- doc/schemas | grep -q '^+.*"added"'; then \ - git diff origin/master -- doc/schemas; \ + if git show --format=%B -s $(BASE_REF).. | grep -q '^No-schema-diff-check'; then echo $@ suppressed; exit 0; fi; \ + if git diff $(BASE_REF) -- doc/schemas | grep -q '^+.*{' && ! git diff $(BASE_REF) -- doc/schemas | grep -q '^+.*"added"'; then \ + git diff $(BASE_REF) -- doc/schemas; \ echo 'New schema fields must have "added": "vNEXTVERSION"' >&2; exit 1; \ fi + schema-removed-check: - @if ! test -z $$CI; then git fetch origin master; fi; \ - if git diff origin/master -- doc/schemas | grep -q '^-.*{' && ! git diff origin/master -- doc/schemas | grep -q '^-.*"deprecated"' && ! git diff origin/master -- doc/schemas | grep -q '^-.*EXPERIMENTAL_FEATURES'; then \ - git diff origin/master -- doc/schemas ; \ + if git show --format=%B -s $(BASE_REF).. | grep -q '^No-schema-diff-check'; then echo $@ suppressed; exit 0; fi; \ + if git diff $(BASE_REF) -- doc/schemas | grep -q '^-.*{' && ! git diff $(BASE_REF) -- doc/schemas | grep -q '^-.*"deprecated"' && ! git diff $(BASE_REF) -- doc/schemas | grep -q '^-.*EXPERIMENTAL_FEATURES'; then \ + git diff $(BASE_REF) -- doc/schemas ; \ echo 'Schema fields must be "deprecated", with version, not removed' >&2; exit 1; \ fi schema-diff-check: schema-added-check schema-removed-check -# This breaks current commit; will revert after. -#check-source: schema-diff-check +check-source: schema-diff-check