Skip to content

chore(workflow): update format job #2

chore(workflow): update format job

chore(workflow): update format job #2

Workflow file for this run

name: Format
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18.17.0'
- name: Cache npm dependencies
id: cache-npm
uses: actions/cache@v3
with:
path: |
~/.npm
node_modules
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies
run: npm install
- name: Verify Prettier version
run: npx prettier --version
- name: Check Prettier configuration
run: cat .prettierrc
- name: Check Prettier formatting
run: |
echo "Checking Prettier formatting..."
npm run prettier:check || echo "Prettier check failed"
- name: Run Prettier to fix formatting issues
if: failure()
run: |
echo "Running Prettier to fix formatting issues..."
npm run prettier:write
- name: Verify Prettier formatting on latest commit
if: success()
run: npm run prettier:check