Open anthony-steele-cko opened 4 years ago
My format.yml
file is as follows:
name: Format check on pull request
on: pull_request
jobs:
dotnet-format:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Add dotnet-format problem matcher
uses: xt0rted/dotnet-format-problem-matcher@v1
- name: Restore dotnet tools
uses: xt0rted/dotnet-tool-restore@v1
- name: Run dotnet format
id: format
uses: xt0rted/dotnet-format@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
action: "fix"
only-changed-files: true
- name: Commit files
if: steps.format.outputs.has-changes == 'true'
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -a -m 'Automated dotnet-format update
Co-authored-by: ${{ github.event.pull_request.user.login }} <${{ github.event.pull_request.user.id }}+${{ github.event.pull_request.user.login }}@users.noreply.github.com>'
- name: Push changes
if: steps.format.outputs.has-changes == 'true'
uses: ad-m/github-push-action@v0.5.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}
ordering is different to here because we now use the .config\dotnet-tools.json
file to specify which tools need to be installed, and that's only present after checkout.
All working if I change line 20 to
uses: jfversluis/dotnet-format@v1.0.4
Is there a way to run with --fix-style
or --fix-analyzers
? It would be useful to enforce style as well as just the whitespace
@Hona I'm working on a new release that adds support for dotnet-format v4 and v5 which will include these new options. I'm expecting to release it sometime this week.
I am seeing similar to the
nothing to commit, working tree clean
issue here: https://github.com/xt0rted/dotnet-format/issues/10#issuecomment-598464578, and it does not seem to be due to line-ending settingsI made a PR, with the config file similar to given there, and also added extra spaces to a code file, so that the format would have something to fix. The result is that it is formatted on the
format
step, and this is followed by "nothing to commit, working tree clean" at thecommit
step