...
1name: 'Git Dirty Check'
2description: >-
3 Check whether any Git-worthy changes have been made to the checkout.
4runs:
5 using: "composite"
6 steps:
7 - name: "Dirty git Check"
8 shell: bash
9 # On Windows, `git status` doesn't record no-op
10 # line-ending changes in to the index, so things show as
11 # dirty even if they aren't. Trying to `add` them does
12 # trigger the appropriate index update. So do a `git add`
13 # *before* the `git status --porcelain` to work around
14 # Windows being terrible; we'd otherwise put the `git add`
15 # inside of the `if` block to help generate better output
16 # for `git diff`.
17 run: |
18 git add .
19 if [[ -n "$(git status --porcelain)" ]]; then
20 PAGER= git diff --cached
21 exit 1
22 fi
View as plain text