mirror of
https://github.com/supabase/setup-cli.git
synced 2025-12-08 16:16:25 +00:00
chore: simplify an example of diff checking (#69)
The original sample hides the result of `git diff`. So if `git diff` returns an error(e.g. invalid file name specified), the result will be success. We can use `--exit-code ` option if we only want to know whether differences exist without depending on other commands. Ref: https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---exit-code
This commit is contained in:
2
.github/workflows/check-dist.yml
vendored
2
.github/workflows/check-dist.yml
vendored
@@ -38,7 +38,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Compare the expected and actual dist/ directories
|
- name: Compare the expected and actual dist/ directories
|
||||||
run: |
|
run: |
|
||||||
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
|
if ! git diff --ignore-space-at-eol --exit-code --quiet dist/; then
|
||||||
echo "Detected uncommitted changes after build. See status below:"
|
echo "Detected uncommitted changes after build. See status below:"
|
||||||
git diff
|
git diff
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ steps:
|
|||||||
- name: Verify generated types match Postgres schema
|
- name: Verify generated types match Postgres schema
|
||||||
run: |
|
run: |
|
||||||
supabase gen types typescript --local > schema.gen.ts
|
supabase gen types typescript --local > schema.gen.ts
|
||||||
if [ "$(git diff --ignore-space-at-eol schema.gen.ts | wc -l)" -gt "0" ]; then
|
if ! git diff --ignore-space-at-eol --exit-code --quiet schema.gen.ts; then
|
||||||
echo "Detected uncommitted changes after build. See status below:"
|
echo "Detected uncommitted changes after build. See status below:"
|
||||||
git diff
|
git diff
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user