Repository navigation
68 lines (56 loc) · 1.66 KB
/
Copy pathpull_request_check.yml
File metadata and controls
68 lines (56 loc) · 1.66 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: pull_request_check
on:
pull_request:
branches:
- main
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: 检出仓库代码
uses: actions/checkout@v7
- name: 获取 PR 变更文件列表
id: changed_files
uses: tj-actions/changed-files@v47
with:
files: |
src/apps/*.ts
src/categories.ts
src/globalGroups.ts
src/subscription.ts
- name: 校验订阅文件变更数量
run: |
for file in ${{ steps.changed_files.outputs.all_changed_files }}; do
echo "$file was changed"
done
if [ ${{ steps.changed_files.outputs.all_changed_files_count }} -gt 1 ]; then
echo "your src subscription changed files count must <= 1"
exit 1
fi
- name: 配置 Node.js 运行环境
uses: actions/setup-node@v7
with:
node-version: 25
package-manager-cache: false
- name: 启用 corepack 并安装 pnpm
run: |
corepack enable
corepack prepare pnpm@latest --activate
- name: 安装项目依赖
run: pnpm install
- name: 执行项目检查
run: pnpm run check
- name: 执行代码格式化
run: pnpm run format
- name: 执行代码静态检查
run: pnpm run lint
- name: 校验代码格式化结果
run: |
status=$(git status --porcelain)
if [ -n "$status" ]; then
echo "Something wasn’t formatted properly"
git --no-pager diff
exit 1
fi