Skip to content

Commit

Permalink
Update lint.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
filzrev committed Dec 9, 2024
1 parent 350f1f6 commit 014842d
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout
Expand All @@ -27,27 +26,31 @@ jobs:
dotnet-version: |
9.x
- name: Run `dotnet restore` command
- name: Run `dotnet format` command
run: |
dotnet restore
- name: Run `dotnet format` command
run: |
dotnet format whitespace --no-restore --verify-no-changes
dotnet format style --no-restore --verify-no-changes
dotnet format analyzers --no-restore --verify-no-changes
dotnet format --no-restore --verify-no-changes
- name: Add comment to Pull Request
if: ${{ failure() && github.event_name == 'pull_request' }}
shell: pwsh
run: |
$content = '
## Diffs are detected
Run the following commands on the local environment. And commit changes as separated commit.
- `dotnet format whitespace`
- `dotnet format style`
- `dotnet format analyzers`
## Failed to run the `lint.yml` workflow
Run `dotnet format` command on local environment.
And commit changes as separated commit.
'
gh pr comment ${{ github.event.number }} --body "$content" --edit-last || gh pr comment ${{ github.event.number }} --body "$content"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Add comment to PR
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2.9.0
with:
header: `dotnet format`
skip_unchanged: true
recreate: true
message: |
## Failed to run `dotnet format --verify-no-changes` command
Run `dotnet format` command on local environment.
And commit changes as separated commit.

0 comments on commit 014842d

Please sign in to comment.