name: dotnet format

on:
  push:
    branches: [ main ]
    paths:
    - '**.cs'
    - '.editorconfig'
  pull_request:
    branches: [ main ]
    paths:
    - '**.cs'
    - '.editorconfig'
  merge_group:
  workflow_dispatch:

permissions:
  contents: read

jobs:
  check-format:
    runs-on: windows-latest
    steps:
      
    - name: Checkout
      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # tag: v4.2.2

    - name: Setup .NET
      uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # tag: v4.3.1
      with:
        dotnet-version: 9.0.302

    - name: dotnet format
      run: dotnet format .\OpenTelemetry.AutoInstrumentation.sln --no-restore --verify-no-changes
