Skip to content

Commit

Permalink
PLEASE WORKK!
Browse files Browse the repository at this point in the history
  • Loading branch information
Nitrrine committed Dec 8, 2023
1 parent 8d1b7c3 commit 24b0d4b
Showing 1 changed file with 14 additions and 33 deletions.
47 changes: 14 additions & 33 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: Prettier
name: Prettier Check and Format

on:
push:
branches:
- main
pull_request:
branches:
- main
on: [push, pull_request]

jobs:
prettier:
Expand All @@ -17,36 +11,23 @@ jobs:
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v3
with:
node-version: "18"

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

- name: Install dependencies
run: npm install

- name: Run Prettier
run: npx prettier --write .
- name: Check for unformatted code
run: npx prettier --check .'

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

- name: Check for changes
- name: Commit and push changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git pull
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add .
git diff --exit-code --quiet || git commit -m "Run Prettier"
- name: Push changes
if: github.event_name == 'push'
uses: ad-m/[email protected]
with:
branch: main
github_token: ${{ secrets.PUSH_TOKEN }}
git commit -m "Format code with Prettier"
git push

0 comments on commit 24b0d4b

Please sign in to comment.