Skip to content

Commit bfe009d

Browse files
committed
doc/Makefile: restore CI check for schema changes.
We now know the base reference, and we've rebased, so we can do a simple diff. Also, this means we can use a magic commit message `No-schema-diff-check` to suppress false positives. Signed-off-by: Rusty Russell <[email protected]>
1 parent 8c0e33a commit bfe009d

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

doc/Makefile

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,18 +227,19 @@ doc/index.rst: $(MANPAGES:=.md)
227227
python3 devtools/blockreplace.py doc/index.rst manpages --language=rst --indent " " \
228228
)
229229

230-
# For CI to (very roughly!) check that we only deprecated fields, or labelled added ones
231-
# When running on GitHub (CI=true), we need to fetch origin/master
230+
# Overridden by GH CI if necessary.
231+
BASE_REF=master
232232
schema-added-check:
233-
@if ! test -z $$CI; then git fetch origin master; fi; \
234-
if git diff origin/master -- doc/schemas | grep -q '^+.*{' && ! git diff origin/master -- doc/schemas | grep -q '^+.*"added"'; then \
235-
git diff origin/master -- doc/schemas; \
233+
if git show --format=%B -s $(BASE_REF).. | grep -q '^No-schema-diff-check'; then echo $@ suppressed; exit 0; fi; \
234+
if git diff $(BASE_REF) -- doc/schemas | grep -q '^+.*{' && ! git diff $(BASE_REF) -- doc/schemas | grep -q '^+.*"added"'; then \
235+
git diff $(BASE_REF) -- doc/schemas; \
236236
echo 'New schema fields must have "added": "vNEXTVERSION"' >&2; exit 1; \
237237
fi
238+
238239
schema-removed-check:
239-
@if ! test -z $$CI; then git fetch origin master; fi; \
240-
if git diff origin/master -- doc/schemas | grep -q '^-.*{' && ! git diff origin/master -- doc/schemas | grep -q '^-.*"deprecated"'; then \
241-
git diff origin/master -- doc/schemas ; \
240+
if git show --format=%B -s $(BASE_REF).. | grep -q '^No-schema-diff-check'; then echo $@ suppressed; exit 0; fi; \
241+
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 \
242+
git diff $(BASE_REF) -- doc/schemas ; \
242243
echo 'Schema fields must be "deprecated", with version, not removed' >&2; exit 1; \
243244
fi
244245

0 commit comments

Comments
 (0)