Skip to content

Commit

Permalink
test dotnet format for only changed files
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-erojaslizano committed May 23, 2024
1 parent 63e5c5b commit c19101d
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,22 @@ jobs:
- name: Run dotnet restore
run: dotnet restore

- name: Run dotnet format
run: dotnet format --verify-no-changes --no-restore
- name: Fetch all history for all branches and tags
run: git fetch --prune --unshallow


- name: Determine changed files
id: changed-files
run: |
PR_NUMBER=$(echo "${{ github.event.number }}" | tr -d '\n')
PR_FILES=$(curl -s "https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER/files" | jq -r '.[].filename')
echo "CHANGED_FILES=$PR_FILES" >> $GITHUB_ENV
- name: Run dotnet format on changed files
run: |
for file in $CHANGED_FILES; do
if [[ $file == *.cs ]]; then
echo "Formatting $file"
dotnet format $file --include $file --verify-no-changes --no-restore
fi
done

0 comments on commit c19101d

Please sign in to comment.