Skip to content

Instantly share code, notes, and snippets.

@xuhaibahmad
Forked from raxityo/prettier.yml
Created July 19, 2024 05:20
Show Gist options
  • Save xuhaibahmad/09e7fe2d69a26b25073acb43b9f440bf to your computer and use it in GitHub Desktop.
Save xuhaibahmad/09e7fe2d69a26b25073acb43b9f440bf to your computer and use it in GitHub Desktop.
# GitHub Action that will run prettier on the whole repo and commit the changes to the PR.
name: Prettier
on:
pull_request:
branches: [main]
jobs:
prettier:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 21
cache: npm
- name: Install dependencies
run: npm ci
- name: Run Prettier
run: npx prettier --write .
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "chore:prettier"
branch: ${{ github.head_ref }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment