From d4bdd23b223e715101781b20f66de2633ecccef4 Mon Sep 17 00:00:00 2001 From: James Gunn Date: Thu, 19 Dec 2024 14:59:07 +0000 Subject: [PATCH] Use local dotnet-format version (#1759) We have a specific version of `dotnet-format` specified in local tools but our commands have been using the version in the current SDK. --- .github/workflows/pr.yml | 3 ++- justfile | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 51149f2b2..aa031f6ec 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -29,6 +29,7 @@ jobs: - name: Lint run: | git fetch origin main --quiet --depth=1 + CHANGED_FILES=$(git diff --name-only origin/main $GITHUB_SHA | { grep -oP '^TeachingRecordSystem\/\K.*\.cs(proj)?$' || true; }) if [ "$CHANGED_FILES" == "" ]; then @@ -46,7 +47,7 @@ jobs: echo "::notice::Linting changed files only" fi - dotnet format --verify-no-changes $INCLUDE_ARG + dotnet dotnet-format --verify-no-changes $INCLUDE_ARG working-directory: TeachingRecordSystem validate_terraform: diff --git a/justfile b/justfile index 76f57c1ac..ae232c99b 100644 --- a/justfile +++ b/justfile @@ -42,7 +42,7 @@ test: # Format the .NET solution and Terraform code format: - @cd {{solution-root}} && dotnet format + @cd {{solution-root}} && dotnet dotnet-format @terraform fmt terraform/aks # Format any un-committed .tf or .cs files @@ -64,7 +64,7 @@ format-changed: $changedCsFiles = (Get-ChangedFiles "{{solution-root}}/**/*.cs") | foreach { $_ -Replace "^{{solution-root}}/", "" } if ($changedCsFiles.Length -gt 0) { - $dotnetArgs = @("format", "--no-restore", "--include") + $changedCsFiles + $dotnetArgs = @("dotnet-format", "--no-restore", "--include") + $changedCsFiles cd {{solution-root}} && dotnet $dotnetArgs }