Skip to content

Commit 0d4b2bc

Browse files
committed
add check for unstaged changes
1 parent 806829a commit 0d4b2bc

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ jobs:
3333
- name: Install Chat Dependencies
3434
run: cd chat && bun install
3535

36+
- name: Run make gen and check for unstaged changes
37+
run: |
38+
make gen
39+
./check_unstaged.sh
40+
3641
- name: Build and Upload
3742
env:
3843
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

check_unstaged.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
FILES=()
4+
IFS=$'\n' read -r -d '' -a FILES < <(git ls-files --other --modified --exclude-standard && printf '\0')
5+
# FILES="$(git ls-files --other --modified --exclude-standard)"
6+
if [[ "$FILES" != "" ]]; then
7+
8+
echo
9+
echo "The following files contain unstaged changes:"
10+
echo
11+
for file in "${FILES[@]}"; do
12+
echo " - $file"
13+
done
14+
15+
echo
16+
echo "These are the changes:"
17+
echo
18+
for file in "${FILES[@]}"; do
19+
git --no-pager diff -- "$file" 1>&2
20+
done
21+
22+
echo
23+
echo "ERROR: Unstaged changes, see above for details."
24+
exit 1
25+
fi

0 commit comments

Comments
 (0)