Merge pull request #940 from Ansh101112/wish #35
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: Auto Format with Prettier | |
on: | |
push: | |
branches: | |
- main # Adjust as per your default branch | |
jobs: | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install Node.js and npm | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' # Adjust to match your project's Node.js version | |
- name: Install dependencies | |
run: npm install | |
- name: Run Prettier to format code | |
run: npm run format | |
- name: Commit formatted code | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
git add . | |
git diff-index --quiet HEAD || git commit -m "Auto-format code using Prettier" | |
git push origin main |