[fix]: prettier ci #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Prettier Check | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
prettier: | |
name: Run Prettier | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 21.1.0 | |
- name: Install dependencies | |
run: npm ci --only=dev | |
- name: Run Prettier | |
run: npm run prettier:github-action | |
- name: Check Prettier formatting | |
id: prettier-status | |
run: | | |
npm run prettier:github-action || echo 'failed' | |
echo "::set-output name=prettier-status::${{ steps.prettier-status.outputs.stdout }}" | |
enforce-prettier: | |
name: Enforce Prettier | |
needs: prettier | |
runs-on: ubuntu-latest | |
if: ${{ needs.prettier.outputs.prettier-status == 'failed' }} | |
steps: | |
- name: Fail the build on Prettier errors | |
run: exit 1 |