-
Notifications
You must be signed in to change notification settings - Fork 26
43 lines (36 loc) · 1.18 KB
/
autocorrect-check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: AutoCorrect Markdown Check
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
autocorrect:
name: Check and Auto-fix Markdown Formatting
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
- name: Install and run format
run: |
# 安装 autocorrect
curl -sSL https://raw.githubusercontent.com/huacnlee/autocorrect/main/install | sh
# 修复文件格式
autocorrect --fix
# 安装并运行 prettier
npm install -g prettier
prettier --write .
# 检查是否有文件更改
- name: Check for changes
run: git diff --exit-code || git status
# 如果有更改,则配置 Git 提交用户名和邮箱,并提交更改
- name: Commit changes
if: failure()
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "fix(typo): Fix Markdown formatting"
git push origin HEAD:main