Skip to content

Commit 8cdedff

Browse files
committed
chore: break out json schema drift check into separate script
Signed-off-by: Alex Goodman <[email protected]>
1 parent e738c4b commit 8cdedff

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
set -u
3+
4+
if ! git diff-index --quiet HEAD --; then
5+
git diff-index HEAD --
6+
echo "there are uncommitted changes, please commit them before running this check"
7+
exit 1
8+
fi
9+
10+
success=true
11+
12+
if ! make generate-json-schema; then
13+
echo "Generating json schema failed"
14+
success=false
15+
fi
16+
17+
if ! git diff-index --quiet HEAD --; then
18+
git diff-index HEAD --
19+
echo "JSON schema drift detected!"
20+
success=false
21+
fi
22+
23+
if ! $success; then
24+
exit 1
25+
fi

Makefile

+1-4
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,7 @@ check-go-mod-tidy:
132132

133133
check-json-schema-drift:
134134
$(call title,Ensure there is no drift between the JSON schema and the code)
135-
@git diff-index --quiet HEAD -- || (echo "there are uncommitted changes, please commit them before running this check" && false)
136-
@make generate-json-schema || (echo "$(RED)$(BOLD)JSON schema drift detected!$(RESET)" && false)
137-
@git diff-index --quiet HEAD -- || (echo "$(RED)$(BOLD)JSON schema drift detected!$(RESET)" && false)
138-
135+
@.github/scripts/json-schema-drift-check.sh
139136

140137
## Testing targets #################################
141138

0 commit comments

Comments
 (0)