Skip to content

Commit 1cd109b

Browse files
author
Petr Sramek
committed
test
1 parent b606930 commit 1cd109b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.github/workflows/format-cs-files.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,52 @@ jobs:
3535
uses: actions/checkout@v4
3636
with:
3737
fetch-depth: 0
38+
3839
- name: Setup .NET
3940
uses: actions/setup-dotnet@v4
4041
with:
4142
dotnet-version: ${{ env.dotnet-sdk-version }}
43+
4244
- name: Install dotnet-format tool
4345
run: dotnet tool install -g dotnet-format
46+
4447
- name: Format with .NET CLI
4548
run: |
4649
git checkout ${{ github.head_ref || github.ref }}
4750
dotnet format whitespace --verbosity diagnostic
4851
dotnet format style --verbosity diagnostic
4952
dotnet format analyzers --diagnostics IDE0005 IDE0073 --verbosity diagnostic
5053
working-directory: ${{ github.workspace }}
54+
5155
- if: runner.os == 'Windows'
5256
run: |
5357
git config --global core.autocrlf false
5458
git config --global core.eol lf
59+
5560
- if: runner.os != 'Windows'
5661
run: |
5762
git config --global core.autocrlf true
5863
git config --global core.eol lf
64+
65+
- name: Validate with .NET ${{ vars.DOTNET_SDK_VERSION }}
66+
id: validate
67+
shell: bash
68+
run: |
69+
set +e
70+
git diff --quiet --exit-code --cached
71+
echo has-changes="$?" >> $GITHUB_OUTPUT
72+
set -e
73+
working-directory: ${{ github.workspace }}
74+
75+
- name: Review state
76+
run: |
77+
echo ${{ steps.validate.outputs.has-changes }}
78+
echo ${{ fromJSON(steps.validate.outputs.has-changes) }}
79+
echo ${{ fromJSON(steps.validate.outputs.has-changes) == 1 }}
80+
echo ${{ fromJSON(steps.validate.outputs.has-changes) == '1' }}
81+
5982
- name: Push changes to ${{ github.head_ref || github.ref }}
83+
if: ${{ fromJSON(steps.validate.outputs.has-changes) == '1' }}
6084
run: |
6185
git add .
6286
git config user.name "$(git log -n 1 --pretty=format:%an)"

0 commit comments

Comments
 (0)