Skip to content

Commit 19654a3

Browse files
authored
ci: use a smarter check for uncommitted files (#612)
This is stolen from a recent kubeflow PR by @ederign. Compared to the previous version, this also reports on new untracked files. Also, the command is much simpler to read.
1 parent a0fd31e commit 19654a3

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

.github/workflows/code-quality.yaml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,15 @@ jobs:
1919

2020
- name: Check there aren't any modified files present
2121
run: |
22-
if [[ $(git ls-files . -d -m -o --exclude-standard --full-name -v | tee modified.log | wc -l) -gt 0 ]]; then
23-
echo "There are changed files"
24-
exit 1
22+
clean=$(git status --porcelain)
23+
if [[ -z "$clean" ]]; then
24+
echo "Empty git status --porcelain: $clean"
25+
else
26+
echo "Uncommitted file changes detected: $clean"
27+
git diff
28+
exit 1
2529
fi
2630
27-
- name: Print modified files
28-
if: ${{ failure() }}
29-
run: |
30-
cat modified.log
31-
git diff
32-
3331
code-static-analysis:
3432
runs-on: ubuntu-latest
3533
steps:

0 commit comments

Comments
 (0)