Skip to content

Commit f74d9c2

Browse files
author
Petr Sramek
committed
refactored format-cs-files.yml
1 parent 2f7cd3b commit f74d9c2

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ concurrency:
2222
cancel-in-progress: false
2323

2424
jobs:
25-
versioning:
25+
formatting:
2626
name: Format file headers with .NET ${{ vars.DOTNET_SDK_VERSION }}
2727
runs-on: ubuntu-latest
2828
steps:
@@ -33,11 +33,20 @@ jobs:
3333
uses: actions/setup-dotnet@v4
3434
with:
3535
dotnet-version: ${{ vars.DOTNET_SDK_VERSION }}
36+
- run: |
37+
dotnet format whitespace --no-restore --verify-no-changes --verbosity diagnostic
38+
dotnet format style --no-restore --verify-no-changes --verbosity diagnostic
39+
dotnet format analyzers --no-restore --verify-no-changes --diagnostics IDE0073 --verbosity diagnostic
40+
echo "has-changes=true" >> "$GITHUB_OUTPUT"
41+
id: validate
42+
continue-on-error: true
43+
working-directory: ${{ github.workspace }}
3644
- run: |
3745
dotnet format whitespace
3846
dotnet format style
3947
dotnet format analyzers --no-restore --diagnostics IDE0073 --verbosity diagnostic
4048
name: Apply style formatting and file header rule
49+
if: ${{ steps.validate.output.has-changes != true }}
4150
working-directory: ${{ github.workspace }}
4251
- run: |
4352
git add .
@@ -47,4 +56,5 @@ jobs:
4756
git pull origin ${{ github.ref }}
4857
git push origin ${{ github.ref }}
4958
name: Push style formatting and file header rule to ${{ github.ref }}
59+
if: ${{ steps.validate.output.has-changes != true }}
5060
working-directory: ${{ github.workspace }}

0 commit comments

Comments
 (0)