-
-
Save egil/fccf31406569bf6f10008c4d8cd32716 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/[email protected] | |
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/[email protected] | |
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/[email protected] | |
with: | |
author_name: Github Actions | |
author_email: [email protected] | |
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