Skip to content

Commit 234a8a9

Browse files
committed
contrib: add check-dirty.sh script and update CI
Signed-off-by: Yuki Kishimoto <[email protected]>
1 parent 8fb8742 commit 234a8a9

File tree

2 files changed

+35
-8
lines changed

2 files changed

+35
-8
lines changed

.github/actions/generate/action.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,5 @@ runs:
4343

4444
- name: Check if repository is dirty
4545
shell: bash
46-
env:
47-
EXCLUDE: ${{ inputs.platform == 'android' && 'ios' || 'android' }}
4846
run: |
49-
if [[ -n "$(git status --porcelain | grep -v ". $EXCLUDE" | grep -v example/ios/Podfile.lock)" ]]; then
50-
>&2 echo "Found unexpected changes in repository after generating"
51-
git status --short
52-
git diff
53-
exit 1
54-
fi
47+
bash contrib/scripts/check-dirty.sh

contrib/scripts/check-dirty.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
set -exuo pipefail
4+
5+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6+
ROOT_DIR="${SCRIPT_DIR}/../.."
7+
8+
# Collect changed files (excluding lines matching $EXCLUDE and the Podfile.lock)
9+
CHANGED_FILES="$(git status --porcelain | grep -v example/ios/Podfile.lock | awk '{print $2}')"
10+
11+
# If there are changes, show details and file contents
12+
if [[ -n "$CHANGED_FILES" ]]; then
13+
>&2 echo "Found unexpected changes in repository after generating"
14+
git status --short
15+
git --no-pager diff
16+
17+
for file in $CHANGED_FILES; do
18+
full_path="${ROOT_DIR}/$file"
19+
20+
# Skip directories
21+
if [ -d "$full_path" ]; then
22+
echo "Skipping directory: $file"
23+
continue
24+
fi
25+
26+
echo "-------------------------"
27+
echo "Full content of $file:"
28+
echo "-------------------------"
29+
cat "$full_path"
30+
echo
31+
done
32+
33+
exit 1
34+
fi

0 commit comments

Comments
 (0)