test: deploy website #338
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: 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 |