Skip to content

Schedule preview

Schedule preview #24

Workflow file for this run

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