update: 更新js格式化统一prettier配置文件 #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run Prettier on Commit | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
format: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: npm ci || npm install | |
- name: Run Prettier | |
run: npx prettier --write "**/*.js" | |
# 可选:提交格式化后的代码 | |
- name: Commit and push changes | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git add leetcodeRating_greasyfork.user.js | |
git commit -m "chore: format with Prettier" || echo "No changes to commit" | |
git push |