Skip to content

fix formatter

fix formatter #234

name: Verify formatting 🎨
on:
workflow_dispatch:
pull_request:
branches: [main]
permissions:
contents: read
jobs:
formatting:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
# - name: Get Prettier version from package-lock.json
# run: |
# PRETTIER_VERSION=$(grep -m 1 'prettier' package-lock.json | cut -d '"' -f 4 | cut -c 2-)
# echo $PRETTIER_VERSION
# - name: Install Prettier
# run: npm install prettier
# - name: Get Prettier version from package-lock.json
# run: |
# PRETTIER_VERSION=$(npm list prettier --json | jq -r '.dependencies.prettier.version')
# echo "Detected Prettier version: $PRETTIER_VERSION"
# echo "PRETTIER_VERSION=$PRETTIER_VERSION" >> $GITHUB_ENV
# - name: Check formatting
# run: |
# npx prettier --check --config .prettierrc .
- name: Prettify code
uses: creyD/[email protected]
with:
dry: True
prettier_options: --check --config .prettierrc .
- name: Fail if formatting check failed
if: failure()
run: |
echo "Formatting check failed. Please format your code according to the project's Prettier configuration."
exit 1