1- name : Prettier code formatter
2- 3- on :
4- pull_request :
5- branches :
6- - master
7- - main
8- push :
9- branches :
10- - master
11- - main
12- 13- jobs :
14- check :
15- # available images: https://github.com/actions/runner-images#available-images
16- runs-on : ubuntu-latest
17- steps :
18- - name : Checkout ποΈ
19- uses : actions/checkout@v4
20- - name : Setup Node.js βοΈ
21- uses : actions/setup-node@v4
22- - name : Install Prettier πΎ
23- run : npm install --save-dev --save-exact prettier @shopify/prettier-plugin-liquid
24- - name : Prettier Check π
25- id : prettier
26- run : npx prettier . --check
27- - name : Create diff π
28- # https://docs.github.com/en/actions/learn-github-actions/expressions#failure
29- if : ${{ failure() }}
30- run : |
31- npx prettier . --write
32- git diff -- . ':(exclude)package-lock.json' ':(exclude)package.json' > diff.txt
33- npm install -g diff2html-cli
34- diff2html -i file -s side -F diff.html -- diff.txt
35- - name : Upload html diff β¬οΈ
36- id : artifact-upload
37- if : ${{ failure() && steps.prettier.conclusion == 'failure' }}
38- uses : actions/upload-artifact@v4
39- with :
40- name : HTML Diff
41- path : diff.html
42- retention-days : 7
43- - name : Dispatch information to repository π£οΈ
44- if : ${{ failure() && steps.prettier.conclusion == 'failure' && github.event_name == 'pull_request' }}
45- uses : peter-evans/repository-dispatch@v2
46- with :
47- event-type : prettier-failed-on-pr
48- client-payload : ' {"pr_number": "${{ github.event.number }}", "artifact_url": "${{ steps.artifact-upload.outputs.artifact-url }}", "run_id": "${{ github.run_id }}"}'
1+ # name: Prettier code formatter
2+ #
3+ # on:
4+ # pull_request:
5+ # branches:
6+ # - master
7+ # - main
8+ # push:
9+ # branches:
10+ # - master
11+ # - main
12+ #
13+ # jobs:
14+ # check:
15+ # # available images: https://github.com/actions/runner-images#available-images
16+ # runs-on: ubuntu-latest
17+ # steps:
18+ # - name: Checkout ποΈ
19+ # uses: actions/checkout@v4
20+ # - name: Setup Node.js βοΈ
21+ # uses: actions/setup-node@v4
22+ # - name: Install Prettier πΎ
23+ # run: npm install --save-dev --save-exact prettier @shopify/prettier-plugin-liquid
24+ # - name: Prettier Check π
25+ # id: prettier
26+ # run: npx prettier . --check
27+ # - name: Create diff π
28+ # # https://docs.github.com/en/actions/learn-github-actions/expressions#failure
29+ # if: ${{ failure() }}
30+ # run: |
31+ # npx prettier . --write
32+ # git diff -- . ':(exclude)package-lock.json' ':(exclude)package.json' > diff.txt
33+ # npm install -g diff2html-cli
34+ # diff2html -i file -s side -F diff.html -- diff.txt
35+ # - name: Upload html diff β¬οΈ
36+ # id: artifact-upload
37+ # if: ${{ failure() && steps.prettier.conclusion == 'failure' }}
38+ # uses: actions/upload-artifact@v4
39+ # with:
40+ # name: HTML Diff
41+ # path: diff.html
42+ # retention-days: 7
43+ # - name: Dispatch information to repository π£οΈ
44+ # if: ${{ failure() && steps.prettier.conclusion == 'failure' && github.event_name == 'pull_request' }}
45+ # uses: peter-evans/repository-dispatch@v2
46+ # with:
47+ # event-type: prettier-failed-on-pr
48+ # client-payload: '{"pr_number": "${{ github.event.number }}", "artifact_url": "${{ steps.artifact-upload.outputs.artifact-url }}", "run_id": "${{ github.run_id }}"}'
0 commit comments