Skip to content

Commit

Permalink
Added GitHub Action to format code after every push/pull request
Browse files Browse the repository at this point in the history
  • Loading branch information
Nitrrine committed Dec 8, 2023
1 parent 862b6e6 commit e603f81
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Prettier

on: [push, pull_request]

jobs:
prettier:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: |
node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "18"

- name: Install dependencies
run: npm install

- name: Format code
run: npx prettier --write .

- name: Commit and push changes
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add .
git commit -m "Format code with Prettier"
git push

0 comments on commit e603f81

Please sign in to comment.