name: Format
on:
  push:
    branches:
      - master
  # Run formatter against the forked branch, but
  # do not allow access to secrets
  # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflows-in-forked-repositories
  pull_request:

env:
  SDK_VERSION: "10.0.x"

jobs:
  format-check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

      - uses: actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0
        with:
          dotnet-version: ${{ env.SDK_VERSION }}

      - name: Run DotNet Format
        run: dotnet format --verify-no-changes --verbosity minimal
