@@ -35,28 +35,52 @@ jobs:
35
35
uses : actions/checkout@v4
36
36
with :
37
37
fetch-depth : 0
38
+
38
39
- name : Setup .NET
39
40
uses : actions/setup-dotnet@v4
40
41
with :
41
42
dotnet-version : ${{ env.dotnet-sdk-version }}
43
+
42
44
- name : Install dotnet-format tool
43
45
run : dotnet tool install -g dotnet-format
46
+
44
47
- name : Format with .NET CLI
45
48
run : |
46
49
git checkout ${{ github.head_ref || github.ref }}
47
50
dotnet format whitespace --verbosity diagnostic
48
51
dotnet format style --verbosity diagnostic
49
52
dotnet format analyzers --diagnostics IDE0005 IDE0073 --verbosity diagnostic
50
53
working-directory : ${{ github.workspace }}
54
+
51
55
- if : runner.os == 'Windows'
52
56
run : |
53
57
git config --global core.autocrlf false
54
58
git config --global core.eol lf
59
+
55
60
- if : runner.os != 'Windows'
56
61
run : |
57
62
git config --global core.autocrlf true
58
63
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
+
59
82
- name : Push changes to ${{ github.head_ref || github.ref }}
83
+ if : ${{ fromJSON(steps.validate.outputs.has-changes) == '1' }}
60
84
run : |
61
85
git add .
62
86
git config user.name "$(git log -n 1 --pretty=format:%an)"
0 commit comments