Skip to content

Commit 77ab5b0

Browse files
authored
Merge pull request #1 from zevorn/main
Add repository readme and docs framework
2 parents ca83397 + 6c8e0fc commit 77ab5b0

File tree

9 files changed

+502
-2
lines changed

9 files changed

+502
-2
lines changed

.github/pull_request_template.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## 关联章节/文件
2+
<!-- 请填写您修改的文档路径或代码文件路径,例如: -->
3+
- 文档路径:`docs/1-install/2-partition.md`
4+
5+
## 修改类型
6+
<!-- 请选择一项或多项,并用 [x] 标记 -->
7+
- [ ] 内容补充
8+
- [ ] 错别字/语句修正
9+
- [ ] 格式调整
10+
- [ ] 图片/附件更新
11+
- [ ] 代码示例修改
12+
- [ ] 其他 (请说明):
13+
14+
## 修改描述
15+
<!-- 请简要描述您本次修改的主要内容和原因 -->
16+
-
17+
-
18+
19+
## 本地验证
20+
<!-- 请确保您已在本地完成以下检查 -->
21+
- [ ] 已通过 `autocorrect .` (或 `autocorrect --lint .` 检查并通过)
22+
- [ ] 已执行 `zensical serve` 并在本地预览,确认页面渲染正常、链接有效、排版美观
23+
24+
## 附加说明 (可选)
25+
<!-- 如有其他需要说明的事项,请在此填写 -->

.github/workflows/lint.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
pull_request:
8+
branches:
9+
- '*'
10+
paths:
11+
- '**/*.md'
12+
13+
# 添加权限声明
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
18+
jobs:
19+
markdown-lint:
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
ref: ${{ github.event.pull_request.head.sha || github.ref }}
28+
persist-credentials: true
29+
30+
- name: Debug info
31+
run: |
32+
echo "PR head ref: ${{ github.event.pull_request.head.ref || 'N/A' }}"
33+
echo "Current ref: ${{ github.ref }}"
34+
35+
- name: Lint
36+
continue-on-error: true
37+
run: |
38+
curl -fsSL https://raw.githubusercontent.com/huacnlee/autocorrect/main/install | sh
39+
autocorrect --fix
40+
41+
- name: Check for changes
42+
id: check_changes
43+
run: |
44+
if git diff --quiet; then
45+
echo "No changes detected."
46+
echo "has_changes=false" >> "$GITHUB_OUTPUT"
47+
else
48+
echo "Changes detected. Preparing to commit..."
49+
echo "has_changes=true" >> "$GITHUB_OUTPUT"
50+
fi
51+
52+
- name: Commit changes
53+
if: steps.check_changes.outputs.has_changes == 'true'
54+
run: |
55+
git config --global user.name "github-actions"
56+
git config --global user.email "[email protected]"
57+
git add -A
58+
git commit -m "ci: auto fix formatting by autocorrect [ci skip]"
59+
60+
- name: Push changes
61+
if: steps.check_changes.outputs.has_changes == 'true'
62+
run: git push origin HEAD:${{ github.event.pull_request.head.ref || github.ref }}
63+
continue-on-error: true
64+
65+
- name: Create Pull Request
66+
if: steps.check_changes.outputs.has_changes == 'true'
67+
uses: peter-evans/create-pull-request@v6
68+
with:
69+
commit-message: "ci: auto fix formatting by autocorrect [ci skip]"
70+
branch: auto-fix-${{ github.run_number }}
71+
delete-branch: true
72+
title: "ci: auto fix formatting by autocorrect [ci skip]"
73+
body: |
74+
This PR contains automatic fixes by the `autocorrect` tool.
75+
Generated by GitHub Actions run ${{ github.run_number }}.

0 commit comments

Comments
 (0)