From e4f7e8dc8075cec2e65493363ec9ba4238b0e0cf Mon Sep 17 00:00:00 2001 From: frauniki Date: Sun, 15 Jun 2025 17:28:40 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20add=20prettier=20formatting=20check?= =?UTF-8?q?=20to=20CI=20workflow=20and=20npm=20scripts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- .github/workflows/test.yml | 18 ++++++++++++++++++ package.json | 1 + 2 files changed, 19 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index efcac4d..ea1c4bb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -51,3 +51,21 @@ jobs: run: npm run build - name: Run E2E Tests run: npm run test:e2e + prettier: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'npm' + - name: Install dependencies + run: npm ci + - name: Run Prettier + run: npm run format:check + - name: Prettier Output + if: failure() + run: | + echo "Prettier check failed. Please run 'npm run format' to fix formatting issues." + exit 1 diff --git a/package.json b/package.json index f2dc224..0d6408b 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "deploy:patch": "npm version patch && npm run deploy:build", "lint": "eslint src --ext ts && tsc --noEmit", "format": "prettier --write src", + "format:check": "prettier --check src", "test": "node --no-warnings --experimental-vm-modules $( [ -f ./node_modules/.bin/jest ] && echo ./node_modules/.bin/jest || which jest ) test/unit", "test:all": "npm run test:unit:docker && npm run test:e2e:docker", "test:docker-build": "docker build -t oco-test -f test/Dockerfile .",