Skip to content

Commit 778a7a7

Browse files
Update template_update.yml
1 parent 1f8f1db commit 778a7a7

1 file changed

Lines changed: 23 additions & 4 deletions

File tree

.github/workflows/template_update.yml

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ jobs:
3030
new_sha: ${{ steps.new_sha.outputs.sha }}
3131

3232
steps:
33+
- name: Setup .NET
34+
uses: actions/setup-dotnet@v4
35+
with:
36+
dotnet-version: "10.0.x"
37+
3338
- name: Checkout project repo
3439
uses: actions/checkout@v4
3540
with:
@@ -146,12 +151,26 @@ jobs:
146151
jq ".cookiecutter.template_sha = \"${NEW_SHA}\"" \
147152
.cookiecutter.json > tmp.json && mv tmp.json .cookiecutter.json
148153
154+
#removed deprecated cookiecutter q & a
149155
python /tmp/template-source/hooks/prune_cookiecutter_json.py --cookie .cookiecutter.json --deprecations templates/deprecations.json
150156
151-
git add -A
152-
git commit -m "Template render at ${NEW_SHA}"
153-
154-
TEMPLATE_COMMIT=$(git rev-parse HEAD)
157+
# Format .NET code to reduce whitespace-only churn in PRs
158+
# Try to format a solution if present; otherwise format the repo.
159+
SOLUTION="$(ls -1 *.slnx 2>/dev/null | head -n 1 || true)"
160+
161+
if [ -n "$SOLUTION" ]; then
162+
echo "🧼 Running dotnet format on $SOLUTION"
163+
dotnet restore "$SOLUTION"
164+
dotnet format "$SOLUTION" --no-restore
165+
else
166+
echo "🧼 Running dotnet format (no .slnx found at repo root)"
167+
dotnet format
168+
fi
169+
170+
git add -A
171+
git commit -m "Template render at ${NEW_SHA}"
172+
173+
TEMPLATE_COMMIT=$(git rev-parse HEAD)
155174

156175
# Switch back to repo branch and create update branch
157176
git checkout "${CURRENT_BRANCH}"

0 commit comments

Comments
 (0)