Skip to content

Commit

Permalink
Moved prettier comment on PR to its own action (#2114)
Browse files Browse the repository at this point in the history
Signed-off-by: George Araújo <george.gcac@gmail.com>
  • Loading branch information
george-gca committed Jan 22, 2024
1 parent bbaae0a commit db0a92b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 45 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/prettier-comment-on-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Comment on pull request

on:
repository_dispatch:
types: [prettier-failed-on-pr]

jobs:
comment:
# available images: https://github.com/actions/runner-images#available-images
runs-on: ubuntu-latest
steps:
- name: PR comment with html diff 💬
uses: thollander/actions-comment-pull-request@v2
with:
comment_tag: prettier-failed
pr_number: ${{ github.event.client_payload.pr_number }}
message: |
Failed [prettier code check](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.event.client_payload.run_id }}). Check [this file](${{ github.event.client_payload.artifact_url }}) for more information.
38 changes: 0 additions & 38 deletions .github/workflows/prettier-on-push.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
name: Prettier code formatter (PR)
name: Prettier code formatter

on:
pull_request:
branches:
- master
- main
push:
branches:
- master
- main

jobs:
check:
Expand Down Expand Up @@ -36,10 +40,9 @@ jobs:
name: HTML Diff
path: diff.html
retention-days: 7
- name: PR comment with diff 💬
if: ${{ failure() && steps.prettier.conclusion == 'failure' }}
uses: thollander/actions-comment-pull-request@v2
- name: Dispatch information to repository 🗣️
if: ${{ failure() && steps.prettier.conclusion == 'failure' && github.event_name == 'pull_request' }}
uses: peter-evans/repository-dispatch@v2
with:
comment_tag: prettier-failed
message: |
Failed [prettier code check](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}). Check [this file](${{ steps.artifact-upload.outputs.artifact-url }}) for more information.
event-type: prettier-failed-on-pr
client-payload: '{"pr_number": "${{ github.event.number }}", "artifact_url": "${{ steps.artifact-upload.outputs.artifact-url }}", "run_id": "${{ github.run_id }}"}'

0 comments on commit db0a92b

Please sign in to comment.