Skip to content

Commit e4f7e8d

Browse files
committed
✅ add prettier formatting check to CI workflow and npm scripts
- Add prettier job to GitHub Actions workflow to enforce code formatting - Add format:check script to package.json for checking formatting - Include failure message when prettier check fails in CI
1 parent 15ac076 commit e4f7e8d

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

.github/workflows/test.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,21 @@ jobs:
5151
run: npm run build
5252
- name: Run E2E Tests
5353
run: npm run test:e2e
54+
prettier:
55+
runs-on: ubuntu-latest
56+
steps:
57+
- uses: actions/checkout@v4
58+
- name: Use Node.js
59+
uses: actions/setup-node@v4
60+
with:
61+
node-version: '20.x'
62+
cache: 'npm'
63+
- name: Install dependencies
64+
run: npm ci
65+
- name: Run Prettier
66+
run: npm run format:check
67+
- name: Prettier Output
68+
if: failure()
69+
run: |
70+
echo "Prettier check failed. Please run 'npm run format' to fix formatting issues."
71+
exit 1

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
"deploy:patch": "npm version patch && npm run deploy:build",
5252
"lint": "eslint src --ext ts && tsc --noEmit",
5353
"format": "prettier --write src",
54+
"format:check": "prettier --check src",
5455
"test": "node --no-warnings --experimental-vm-modules $( [ -f ./node_modules/.bin/jest ] && echo ./node_modules/.bin/jest || which jest ) test/unit",
5556
"test:all": "npm run test:unit:docker && npm run test:e2e:docker",
5657
"test:docker-build": "docker build -t oco-test -f test/Dockerfile .",

0 commit comments

Comments
 (0)