Schedule preview #24
Workflow file for this run
This file contains hidden or 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 Code | |
| on: | |
| pull_request: | |
| jobs: | |
| auto-format: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # Required to push to the repo | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.head_ref }} # Checkout PR branch | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run Prettier to format | |
| run: npm run format | |
| - name: Commit and push if changes | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| git diff-index --quiet HEAD || git commit -m "github-actions: auto-format code" | |
| git push |