Skip to content

Instantly share code, notes, and snippets.

@egil
Created August 18, 2020 14:59
Show Gist options
  • Save egil/bc09b177e5d821ef98daa9de865b1cd2 to your computer and use it in GitHub Desktop.
Save egil/bc09b177e5d821ef98daa9de865b1cd2 to your computer and use it in GitHub Desktop.
name: "Format code on PR"
on:
pull_request:
types:
- opened
- synchronize
- reopened
jobs:
dotnet-format:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'
- name: Install dotnet-format
run: dotnet tool install -g dotnet-format
- name: Run dotnet-format
run: dotnet format ./bunit.sln --verbosity diag # CHANGE FORMAT TARGET
- name: Commit formatted files
uses: EndBug/add-and-commit@v4.1.0
with:
add: '.'
author_name: Github Actions
author_email: actions@github.com
message: Automated dotnet-format update
ref: ${{ github.head_ref }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment