-
-
Save jfversluis/50cd7c23c3befd679710ba1a288c934a to your computer and use it in GitHub Desktop.
Runs dotnet-format on every PR and create a commit that fixes the formatting if it doesn't comply with your code convention
This file contains 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 check on pull request | |
on: pull_request | |
jobs: | |
dotnet-format: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v2.2.0 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.head_ref }} | |
- name: Install dotnet-format | |
run: dotnet tool install -g dotnet-format --version 3.3.111304 | |
- name: Run dotnet format | |
id: format | |
uses: xt0rted/dotnet-format@v1.0.2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
action: "fix" | |
only-changed-files: true | |
folder: "." | |
- name: Commit files | |
if: steps.format.outputs.has-changes == 'true' | |
uses: EndBug/add-and-commit@v4.1.0 | |
with: | |
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