Skip to content

Commit

Permalink
chore: workflow will now comment on PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
KTrain5169 committed Jul 5, 2024
1 parent c0bd240 commit b1d31a6
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/prettier-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ name: Check Prettier syntax

# This action works with pull requests and pushes on the main branch
on:
pull_request:
pull_request_target:
push:
branches: [main]

permissions:
pull_requests: write

jobs:
prettier:
name: Prettier Check
Expand All @@ -20,7 +23,6 @@ jobs:
with:
file_pattern: '**'
config_path: ./.prettierrc.yml
fail_on_error: true


# This step only runs if prettier finds errors causing the previous step to fail
Expand All @@ -30,4 +32,13 @@ jobs:
shell: bash
run: |
echo "The following files are not formatted:"
echo "${{steps.prettier-run.outputs.prettier_output}}"
echo "${{steps.prettier-run.outputs.prettier_output}}"
- name: Comment on PRs if failed checks.
if: ${{ failure() }} && github.event_name == 'pull_request':
uses: thollander/[email protected]
with:
message: |
The following files have not been formatted with Prettier:
${{steps.prettier-run.outputs.prettier_output}}
Please go back in and reformat them as necessary.

0 comments on commit b1d31a6

Please sign in to comment.