feat: run Prettier on merge to main #3
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 Merge | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
prettier: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Run Prettier on specific directories | |
run: pnpm prettier --write './packages/core/**/*' './packages/cli/**/*' | |
- name: Commit changes if any | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add . | |
git commit -m "Apply Prettier formatting" | |
git push | |
continue-on-error: true |