Skip to content

Instantly share code, notes, and snippets.

@raxityo
Last active July 19, 2024 10:51
Show Gist options
  • Save raxityo/9954205d741def1ade2c0aa880b7847b to your computer and use it in GitHub Desktop.
Save raxityo/9954205d741def1ade2c0aa880b7847b 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