File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # GitHub Action 集成
2+
3+ ## 说明
4+
5+ 这个仓库用于提供组织的 Github Action 模板,并且在模板变化后同步到其他仓库
6+
7+ ## 目录结构
8+
9+ ``` txt
10+ ├── .github
11+ │ └── workflows
12+ │ ├── teams-check.yml 自动触发的Action,用于在发起的PR 或push 中, 配置文件或Action模板变动时,检查yaml 的合法性
13+ │ ├── teams-update.yml 自动触发的Action,用于在配置文件或Action模板变动时,自动修改Teams 成员
14+ │ ├── jenkins-bridge.yml 可重用的Action文件,在check.yml中引用
15+ │ └── sync.yml 自动触发的Action,用于在配置文件或Action模板变动时,自动同步到其他仓库中
16+ ├── go.mod
17+ ├── go.sum
18+ ├── main.go
19+ ├── README.md
20+ ├── teams.yaml 配置Teams
21+ ├── repos 同步配置,目录下文件发生变动,读取变动的配置,并触发该配置的变动
22+ │ └── peeweep-test
23+ │ └── test-action.json
24+ └── workflow-templates Action模板,在GitHub添加Action时可选择,修改目录下文件,会触发所有配置同步
25+ ├── check.properties.json
26+ └── check.yml
27+ ```
28+
29+ ## 同步配置
30+
31+ 在 repos 中创建任意文件,文件内容格式为 JSON,例子如下
32+
33+ ``` json
34+ [
35+ {
36+ "src" : " workflow-templates/check.yml" ,
37+ "dest" : " peeweep-test/test-action/.github/workflows/check.yml" ,
38+ // 可选项,默认同步文件到所有分支
39+ "brache" : [" main" ]
40+ }
41+ ]
42+ ```
43+
44+ 以上配置将 workflow-templates/check.yml 同步到 peeweep-test/test-action 仓库的 .github/workflows 目录下。
45+
46+ 虽然配置可写在 repos 目录下任意位置,但为了便于维护,建议以仓库路径为文件名
47+
48+ 例如同步到 peeweep-test/test-action 仓库的配置文件建议放置到 repos/peeweep-test/test-action.json
49+
50+ ## Teams 配置
51+
52+ ```
53+ teams:
54+ admin: # team 名
55+ members: # team 成员
56+ - peeweep
57+ dtkcore:
58+ members:
59+ - peeweep
60+ reviewer:
61+ members:
62+ - myml
63+ - peeweep
64+ ```
65+
66+ 成员在team 中的权限默认为 member
67+
68+ 如果成员同时是组织的maintainer, 会自动升级为maintainer
69+
70+ ## TODO
71+
72+ - [x] 同步流程手动触发会无权限同步文件
You can’t perform that action at this time.
0 commit comments