Skip to content

Commit 6cda3b5

Browse files
Flash0verclaudegetsentry-bot
authored
ci: move from dotnet-format tool to .NET SDK command (#4918)
* ci: remove installing global tool dotnet-format * ci: Remove AttributeReaderTests.cs exclusion from dotnet format The exclusion was added as a workaround because dotnet-format was incorrectly deleting assertions in that file. This issue has since been resolved so the exclusion is no longer necessary. Co-Authored-By: Claude <noreply@anthropic.com> * Format code * Revert "Format code" This reverts commit bba983f. * Revert "ci: Remove AttributeReaderTests.cs exclusion from dotnet format" This reverts commit bbcefcb. * ci: Add JSON format report and upload as artifact Generate a dotnet format report via --report and upload it as a CI artifact so formatting issues can be inspected without re-running the job locally. Refs #4918 Co-Authored-By: Claude <noreply@anthropic.com> * ci: Move --report before --exclude arguments Refs #4918 Co-Authored-By: Claude <noreply@anthropic.com> * ci: Consolidate --exclude arguments into a single flag Refs #4918 Co-Authored-By: Claude <noreply@anthropic.com> * ci: Exclude format report directory from git tracking Write a .gitignore into the report directory after uploading the artifact so the generated JSON report is not picked up as a git change by the subsequent commit step. Refs #4918 Co-Authored-By: Claude <noreply@anthropic.com> * ci: Only write .gitignore if report directory exists Avoid unconditionally creating the report directory — only write the .gitignore when dotnet format actually produced the directory. Refs #4918 Co-Authored-By: Claude <noreply@anthropic.com> * ci: use actions/upload-artifact@v7 direct file upload (unzipped) --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Sentry Github Bot <bot+github-bot@sentry.io>
1 parent 2079493 commit 6cda3b5

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

.github/workflows/format-code.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,28 @@ jobs:
2828
dotnet workload restore
2929
dotnet restore Sentry.slnx --nologo
3030
31-
- name: Install dotnet format
32-
run: dotnet tool install -g dotnet-format
33-
3431
- name: Format Code
3532
# We exclude `./**/*OptionsSetup.cs` from the format because the tool struggles with
3633
# source generators.
3734
#
3835
# We exclude `test/Sentry.Tests/AttributeReaderTests.cs` because dotnet-format tries to
3936
# delete assertions in there.
4037
# - see https://github.com/getsentry/sentry-dotnet/pull/4911#discussion_r2795717887
41-
run: dotnet format Sentry.slnx --no-restore --exclude ./modules --exclude ./**/*OptionsSetup.cs --exclude ./test/Sentry.Tests/AttributeReaderTests.cs
38+
run: dotnet format Sentry.slnx --no-restore --report ./dotnet-format-report --exclude ./modules ./**/*OptionsSetup.cs ./test/Sentry.Tests/AttributeReaderTests.cs
39+
40+
- name: Upload Format Report
41+
if: ${{ always() }}
42+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
43+
with:
44+
archive: false
45+
path: ./dotnet-format-report/
46+
if-no-files-found: ignore
47+
48+
- name: Exclude Format Report from Git
49+
run: |
50+
if [ -d ./dotnet-format-report ]; then
51+
echo '*' > ./dotnet-format-report/.gitignore
52+
fi
4253
4354
# actions/checkout fetches only a single commit in a detached HEAD state. Therefore
4455
# we need to pass the current branch, otherwise we can't commit the changes.

0 commit comments

Comments
 (0)