Skip to content

style: 🎨 format code with Prettier #339

style: 🎨 format code with Prettier

style: 🎨 format code with Prettier #339

Workflow file for this run

name: Code formatting check
on:
push:
branches:
- main
jobs:
Format:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Set up Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Install Prettier
run: npm install --save-dev prettier
- name: Format code with Prettier
run: npx prettier --config .prettierrc.js "website/**/*.js" "functions/archivePurchasedPhotos/**/*.js" "functions/compressPublicPhotos/**/*.js" "functions/deletePublicPhotos/**/*.js" --check
- name: Commit changes if needed
if: failure()
run: |
npx prettier --config .prettierrc.js "website/**/*.js" "functions/archivePurchasedPhotos/**/*.js" "functions/compressPublicPhotos/**/*.js" "functions/deletePublicPhotos/**/*.js" --write
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -am "style: :art: format code with Prettier"
git push