chore(deps): update CLI to v3.6.0 #5196
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: format code | |
| on: | |
| pull_request: | |
| paths: | |
| - 'src/**' | |
| - 'test/**' | |
| - 'samples/**' | |
| - '.github/workflows/format-code.yml' | |
| # Serialize with verify-api.yml so the two auto-commit workflows can't race | |
| # each other's git push on the same PR branch. | |
| concurrency: | |
| group: pr-auto-commit-${{ github.event.pull_request.number }} | |
| cancel-in-progress: false | |
| jobs: | |
| format-code: | |
| name: Format Code | |
| # Run on 'macos' because Linux is missing the `ios` workload: https://github.com/dotnet/runtime/issues/85505 | |
| # Pin macos to get the version of XCode that we need: https://github.com/actions/runner-images/issues/10703 | |
| runs-on: macos-15 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| submodules: recursive | |
| - name: Setup Environment | |
| uses: ./.github/actions/environment | |
| - name: Restore .NET Dependencies | |
| # We should be able to get rid of the restore here, if we install the correct workloads in actions/environment | |
| run: | | |
| dotnet workload restore | |
| dotnet restore Sentry.slnx --nologo | |
| - name: Format Code | |
| # We exclude `./**/*OptionsSetup.cs` from the format because the tool struggles with | |
| # source generators. | |
| # | |
| # We exclude `test/Sentry.Tests/AttributeReaderTests.cs` because dotnet-format tries to | |
| # delete assertions in there. | |
| # - see https://github.com/getsentry/sentry-dotnet/pull/4911#discussion_r2795717887 | |
| run: dotnet format Sentry.slnx --no-restore --report ./dotnet-format-report --exclude ./modules ./**/*OptionsSetup.cs ./test/Sentry.Tests/AttributeReaderTests.cs | |
| - name: Upload Format Report | |
| if: ${{ always() }} | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| archive: false | |
| path: ./dotnet-format-report/ | |
| if-no-files-found: ignore | |
| - name: Exclude Format Report from Git | |
| run: | | |
| if [ -d ./dotnet-format-report ]; then | |
| echo '*' > ./dotnet-format-report/.gitignore | |
| fi | |
| # actions/checkout fetches only a single commit in a detached HEAD state. Therefore | |
| # we need to pass the current branch, otherwise we can't commit the changes. | |
| # GITHUB_HEAD_REF is the name of the head branch. GitHub Actions only sets this for PRs. | |
| # | |
| # For fork PRs we can't push back to the contributor's branch, so we fail the check | |
| # instead — prompting the contributor to run dotnet format locally. | |
| - name: Commit Formatted Code | |
| run: | | |
| if [[ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then | |
| if [[ $(git status) != *"nothing to commit"* ]]; then | |
| echo "::error::Formatting issues found. Please run the following command locally and push the result:" | |
| echo "::error:: dotnet format Sentry.slnx --no-restore --exclude ./modules ./**/*OptionsSetup.cs ./test/Sentry.Tests/AttributeReaderTests.cs" | |
| exit 1 | |
| fi | |
| echo "All code formatted correctly." | |
| else | |
| ./scripts/commit-formatted-code.sh $GITHUB_HEAD_REF | |
| fi |