Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
DoonOnthon committed Aug 5, 2023
1 parent d4d7456 commit ea9a811
Showing 1 changed file with 25 additions and 30 deletions.
55 changes: 25 additions & 30 deletions .github/workflows/format-code.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,32 @@
name: Code Formatting
name: Format (prettier)

on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
format-code:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
push:
branches:
- 'master'
pull_request:
paths:
- '**.css'
- '**.js'
- '**.vue'

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 14
jobs:
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Install dependencies
run: npm install
- name: Install
run: yarn install
env:
CI: true

- name: Format code using prettier-action
uses: stefanzweifel/prettier-action@v2
with:
files: . # Specify the files or directories you want to format
prettier: npm # Use 'npm' or 'yarn' depending on your package manager
- name: Run prettier
run: yarn run prettier --write 'src/**/*.{css,js,vue}'

- name: Commit formatted code
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -am "Auto-format code"
git push
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Apply prettier changes

0 comments on commit ea9a811

Please sign in to comment.