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:
y-yagi
2022-10-07 11:45:15 +09:00
committed by GitHub
parent e18397b05b
commit 913e9e7c0a
2 changed files with 2 additions and 2 deletions

View File

@@ -38,7 +38,7 @@ jobs:
- name: Compare the expected and actual dist/ directories
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:"
git diff
exit 1