File tree Expand file tree Collapse file tree 3 files changed +49
-50
lines changed Expand file tree Collapse file tree 3 files changed +49
-50
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ name : Prettier code formatter (PR)
2+
3+ on :
4+ pull_request :
5+ branches :
6+ - master
7+ - main
8+
9+ jobs :
10+ check :
11+ # available images: https://github.com/actions/runner-images#available-images
12+ runs-on : ubuntu-latest
13+ steps :
14+ - name : Checkout 🛎️
15+ uses : actions/checkout@v4
16+ - name : Setup Node.js ⚙️
17+ uses : actions/setup-node@v4
18+ - name : Install Prettier 💾
19+ run : npm install --save-dev --save-exact prettier @shopify/prettier-plugin-liquid
20+ - name : Prettier Check 🔎
21+ id : prettier
22+ run : npx prettier . --check
23+ - name : Create diff 📝
24+ # https://docs.github.com/en/actions/learn-github-actions/expressions#failure
25+ if : ${{ failure() }}
26+ run : |
27+ npx prettier . --write
28+ git diff -- . ':(exclude)package-lock.json' ':(exclude)package.json' > diff.txt
29+ npm install -g diff2html-cli
30+ diff2html -i file -s side -F diff.html -- diff.txt
31+ - name : Upload html diff ⬆️
32+ id : artifact-upload
33+ if : ${{ failure() && steps.prettier.conclusion == 'failure' }}
34+ uses : actions/upload-artifact@v4
35+ with :
36+ name : HTML Diff
37+ path : diff.html
38+ retention-days : 7
39+ - name : PR comment with diff 💬
40+ if : ${{ failure() && steps.prettier.conclusion == 'failure' }}
41+ uses : thollander/actions-comment-pull-request@v2
42+ with :
43+ comment_tag : prettier-failed
44+ message : |
45+ 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.
Original file line number Diff line number Diff line change 1- name : Prettier code formatter
1+ name : Prettier code formatter (push)
22
33on :
4- pull_request :
5- branches :
6- - master
7- - main
84 push :
95 branches :
106 - master
@@ -32,10 +28,11 @@ jobs:
3228 git diff -- . ':(exclude)package-lock.json' ':(exclude)package.json' > diff.txt
3329 npm install -g diff2html-cli
3430 diff2html -i file -s side -F diff.html -- diff.txt
35- - name : Upload html diff
31+ - name : Upload html diff ⬆️
32+ id : artifact-upload
3633 if : ${{ failure() && steps.prettier.conclusion == 'failure' }}
3734 uses : actions/upload-artifact@v4
3835 with :
3936 name : HTML Diff
4037 path : diff.html
41- retention-days : 3
38+ retention-days : 7
You can’t perform that action at this time.
0 commit comments