@@ -38,37 +38,55 @@ jobs:
3838 echo "solution_count=$count" >> "$GITHUB_OUTPUT"
3939
4040 - name : Check formatting
41- if : steps.discover.outputs.solution_count != '0'
4241 shell : bash
4342 run : |
4443 set -euo pipefail
45- while IFS= read -r sln; do
46- [ -z "$sln" ] && continue
47- echo "==> Restoring $sln"
48- dotnet restore "$sln"
44+ ROOT="${GITHUB_WORKSPACE}"
4945
50- echo "==> Running jb cleanupcode"
51- jb cleanupcode "$sln" \
46+ count="${{ steps.discover.outputs.solution_count }}"
47+ if [ "$count" != "0" ]; then
48+ echo "==> Formatting all discovered .sln files"
49+ while IFS= read -r sln; do
50+ [ -z "$sln" ] && continue
51+ echo "==> Restoring $sln"
52+ dotnet restore "$sln"
53+
54+ echo "==> Running jb cleanupcode on $sln"
55+ jb cleanupcode "$sln" \
56+ --profile="Built-in: Reformat Code" \
57+ --no-build \
58+ --verbosity=WARN \
59+ --include="$ROOT/Assets/**/*.cs" \
60+ --exclude="$ROOT/**/bin/**" \
61+ --exclude="$ROOT/**/obj/**" \
62+ --exclude="$ROOT/**/.idea/**" \
63+ --exclude="$ROOT/**/Library/**" \
64+ --exclude="$ROOT/**/Logs/**" \
65+ --exclude="$ROOT/**/Temp/**"
66+ done < solutions.txt
67+ else
68+ echo "==> No .sln files found. Running jb cleanupcode by glob include (absolute paths)."
69+ jb cleanupcode "$ROOT" \
5270 --profile="Built-in: Reformat Code" \
53- --no-build \
5471 --verbosity=WARN \
55- --include="Assets/**/*.cs" \
56- --exclude="**/bin/**" \
57- --exclude="**/obj/**" \
58- --exclude="**/.idea/**" \
59- --exclude="**/Library/**" \
60- --exclude="**/Logs/**" \
61- --exclude="**/Temp/**"
62- done < solutions.txt
72+ --include="$ROOT/ Assets/**/*.cs" \
73+ --exclude="$ROOT/ **/bin/**" \
74+ --exclude="$ROOT/ **/obj/**" \
75+ --exclude="$ROOT/ **/.idea/**" \
76+ --exclude="$ROOT/ **/Library/**" \
77+ --exclude="$ROOT/ **/Logs/**" \
78+ --exclude="$ROOT/ **/Temp/**"
79+ fi
6380
6481 - name : Diff & annotate unformatted files (fail if any)
65- if : steps.discover.outputs.solution_count != '0'
6682 shell : bash
6783 run : |
6884 set -euo pipefail
6985 DIFF_FILE=cleanup.diff
7086 git --no-pager diff --unified=0 -- 'Assets/**/*.cs' > "$DIFF_FILE" || true
7187
88+ git --no-pager diff --name-only -- 'Assets/**/*.cs' || true
89+
7290 if [ -s "$DIFF_FILE" ]; then
7391 echo "Unformatted changes detected in Assets/:"
7492 awk '
85103 else
86104 echo "Formatting is clean in Assets/."
87105 fi
88-
89- - name : No solutions found (informative)
90- if : steps.discover.outputs.solution_count == '0'
91- run : echo "No .sln files found; skipping formatting check."
0 commit comments