mirror of
https://github.com/microsoft/semantic-kernel.git
synced 2026-10-12 02:19:06 +00:00
Update dotnet-format.yml
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user