-
Notifications
You must be signed in to change notification settings - Fork 10
34 lines (32 loc) · 1.08 KB
/
prettier-check.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: Prettier Check
on:
pull_request:
jobs:
check-formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v3
with:
node-version: "20.x"
- run: npm ci
- name: Check formatting
id: check_format
run: |
npm run check || STATUS=$? || true
echo "format_status=$STATUS" >> $GITHUB_OUTPUT
- name: Evaluate formatting
if: always() # Ensures this step always runs, regardless of the previous step's status.
run: |
echo "FORMAT_STATUS='$FORMAT_STATUS'"
if [ $FORMAT_STATUS -ne 0 ]; then
echo '❌ Changes not properly formatted, did you forget to run `npm run format` ?'
echo '❌ Changes not properly formatted, did you forget to run `npm run format` ?' >> $GITHUB_STEP_SUMMARY
exit 1
else
echo '✅ Changes are properly formatted.'
fi
env:
FORMAT_STATUS: ${{ steps.check_format.outputs.format_status }}