name: dotnet-format

on: "push"

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: Setup .NET 6
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: '6.0.x'
        include-prerelease: true
    - name: build
      run: dotnet build
    - name: format
      run: dotnet format
    - name: check for changes
      run: |
        if git diff --exit-code; then
          echo "has_changes=false" >> $GITHUB_ENV
        else
          echo "has_changes=true" >> $GITHUB_ENV
        fi
    - name: Commit and Push
      if: ${{ env.has_changes == 'true' }}
      shell: bash
      run: |
        git config --local user.name "github-actions[bot]"
        git config --local user.email "weihanli@outlook.com"
        git commit -am 'Automated dotnet-format update from $env:GITHUB_REF_NAME $env:GITHUB_SHA'
        git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
        git push origin $env:GITHUB_REF_NAME
 

name: dotnet-format

on: "push"

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: Setup .NET 6
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: '6.0.x'
        include-prerelease: true
    - name: build
      run: dotnet build
    - name: format
      run: dotnet format
    - name: check for changes
      run: |
        if git diff --exit-code; then
          echo "has_changes=false" >> $GITHUB_ENV
        else
          echo "has_changes=true" >> $GITHUB_ENV
        fi
    - name: Commit and Push
      if: ${{ env.has_changes == 'true' }}
      shell: bash
      run: |
        echo $env:GITHUB_REF_NAME
        echo ${{ github.ref.name }}
        git config --local user.name "github-actions[bot]"
        git config --local user.email "weihanli@outlook.com"
        git add -A
        git commit -m 'Automated dotnet-format update from $env:GITHUB_REF_NAME $env:GITHUB_SHA'
        git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
        git push origin $env:GITHUB_REF_NAME
 
Update dotnet format github action
Update dotnet format github action
