Update dotnet-format.yml

This commit is contained in:
Shawn Callegari
2023-04-27 19:51:14 -07:00
committed by GitHub
parent aa8c268c3c
commit 2a149e236e
+7 -7
View File
@@ -21,20 +21,20 @@ jobs:
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v35
uses: jitterbit/get-changed-files@v1
- name: No C# files changed
id: no-csharp
if: steps.changed-files.outputs.any_changed != 'true'
if: steps.changed-files.outputs.added_modified == ''
run: echo "No C# files changed"
# This step will loop over the changed files and find the nearest .csproj file for each one, then store the unique csproj files in a variable
- name: Find csproj files
id: find-csproj
if: steps.changed-files.outputs.any_changed == 'true'
if: steps.changed-files.outputs.added_modified != ''
run: |
csproj_files=()
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
for file in ${{ steps.changed-files.outputs.added_modified }}; do
echo "$file was changed"
dir=$(dirname $file)
while [[ $dir != "." && $dir != "/" ]]; do
@@ -50,18 +50,18 @@ jobs:
echo "{csproj_files}={${csproj_files[*]}}" >> $GITHUB_OUTPUT
- name: Setup .NET Core
if: steps.changed-files.outputs.any_changed == 'true'
if: steps.changed-files.outputs.added_modified != ''
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- name: Install dotnet-format tool
if: steps.changed-files.outputs.any_changed == 'true'
if: steps.changed-files.outputs.added_modified != ''
run: dotnet tool install -g dotnet-format
# This step will run dotnet format on each of the unique csproj files and fail if any changes are made
- name: Run dotnet format
if: steps.changed-files.any_changed == 'true'
if: steps.changed-files.outputs.added_modified != ''
run: |
for csproj in ${{ steps.find-csproj.outputs.csproj_files }}; do
echo "Running dotnet format on $csproj"