From be5627793cd27ba2202b6609f7440d109ea0fd90 Mon Sep 17 00:00:00 2001 From: Administrator <1311781983@qq.com> Date: Mon, 15 Jan 2024 15:57:30 +0800 Subject: [PATCH] add :lifecycle & welcome robot.md --- docs/robot-lifecyle.md | 71 +++++++++++++++++++++++++++++++ docs/robot-welcome.md | 95 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 166 insertions(+) create mode 100644 docs/robot-welcome.md diff --git a/docs/robot-lifecyle.md b/docs/robot-lifecyle.md index e69de29..b515cc7 100644 --- a/docs/robot-lifecyle.md +++ b/docs/robot-lifecyle.md @@ -0,0 +1,71 @@ +# robot-gitee-lifecyle使用指南 + +## 简介 +机器人 为gitee平台用户提供了`/close`与`/reopen`指令来关闭issue和Pull Request以及重新打开已经关闭的issue。 + +源代码:https://github.com/opensourceways/robot-gitee-lifecycle + +## 接收/处理事件类型 + +- Note Hook + +## 核心逻辑 + +```mermaid +graph TD +A[Note Hook] --> B[robot-gitee-lifecycle] +B --> C[判断note是关于什么的类型] +C-->|PR|D[是否PR状态为open且评论内容为close] +C-->|Issue|E[是否Issue状态为open/closed且评论内容为close/reopen] +D-->|是|F[评论人员是否是PR作者或仓库贡献者] +E-->|是|J[评论人员是否是PR作者或仓库贡献者] +F-->|是|H[关闭PR] +J-->|是|I[关闭Issue/重新打开Issue] +``` +注: +- 事件属于PR只能close + + +## 部署运行 + +### 运行参数 + +| 参数 | 说明 | 是否必填 | 默认值 | +| --- | --- | --- | --- | +| port| web服务监听的端口 | 否 | 8888| +| config-file | 配置文件所在路径 | 是 | - | +| gitee-token-path | robot账号的私人令牌所在文件 | 否 | /etc/gitee/oauth | + +### 配置文件 +#### config-file +```yaml +config_items: + - repos: #robot需管理的仓库列表 + - owner/repo + - owner1 + excluded_repos: #robot 管理列表中需排除的仓库 + - owner1/repo1 +``` + + +### 原生方式运行 +以原生方式运行必须保证系统已安装go运行环境,go版本大于1.16。 +在代码根目录执行: +``` +go build -a -o robot-gitee-lifecycle . +``` +在当前目录将会生成名为`robot-gitee-lifecycle`的可执行二进制文件,带入参数执行该文件: + +``` +./robot-gitee-lifecycle --port=8888 --config-file=./config.yaml --gitee-token-path=./token +``` + +### docker容器方式运行 + +以docker容器方式运行是更推荐的方式。 + +在代码根目录有Dockerfile镜像制作文件,执行构建命令 +``` +docker build -t robot-gitee-lifecycle . +``` +之后按照上述的参数运行容器即可。 diff --git a/docs/robot-welcome.md b/docs/robot-welcome.md new file mode 100644 index 0000000..96600d4 --- /dev/null +++ b/docs/robot-welcome.md @@ -0,0 +1,95 @@ +# robot-gitee-welcome使用指南 + +## 简介 +welcome 机器人在用户创建issue 或 pull request的时候会添加如下提示语: +``` +Hey xx, Welcome to xx Community. All of the projects in xx Community are maintained by xx. +That means the developers can comment below every pull request or issue to trigger Bot Commands. Please follow instructions at to find the details. +``` + +源代码:https://github.com/opensourceways/robot-gitee-welcome + +## 接收/处理事件类型 + +- Issue Hook +- Merge Request Hook + +## 核心逻辑 + +```mermaid +graph TD +A[Issue Hook] --> C[robot-gitee-welcome] +B[Merge Request Hook] --> C +C-->D[从PR中获取org,repo] +D-->E[获取配置信息] +E-->|PRAuthor|F[传参构建欢迎评论内容] +F-->|参数|G[评论区打上欢迎内容] + +``` +注: +- 事件只有PR状态为`opend`才会处理 + + +## 部署运行 + +### 运行参数 + +| 参数 | 说明 | 是否必填 | 默认值 | +| --- | --- | --- | --- | +| port| web服务监听的端口 | 否 | 8888| +| config-file | 配置文件所在路径 | 是 | - | +| gitee-token-path | robot账号的私人令牌所在文件 | 否 | /etc/gitee/oauth | + +### 配置文件 +#### config-file +```yaml +config_items: + - repos: #robot需管理的仓库列表 + - owner/repo + - owner1 + excluded_repos: #robot 管理列表中需排除的仓库 + - owner1/repo1 + community_name: opensourceways #社区名(必填项) + community_repo: community #仓库名 + command_link: http://opensourceways.cn/command_link #社区机器指令说明连接(必填项) +``` + + +### 原生方式运行 +以原生方式运行必须保证系统已安装go运行环境,go版本大于1.16。 +在代码根目录执行: +``` +go build -a -o robot-gitee-welcome . +``` +在当前目录将会生成名为`robot-gitee-welcome`的可执行二进制文件,带入参数执行该文件: + +``` +./robot-gitee-welcome --port=8888 --config-file=./config.yaml --gitee-token-path=./token +``` + +### docker容器方式运行 + +以docker容器方式运行是更推荐的方式。 + +在代码根目录有Dockerfile镜像制作文件,执行构建命令 +``` +docker build -t robot-gitee-tide . +``` +之后按照上述的参数运行容器即可。 + +## 可定制功能 + +#### 第一次到社区的作者打上标签newcomer + +#### 打上所属sig组标签:sig/xx +需要在`community_repo`下面的`sig`目录里面存在PR所在org和repo对应关系 + +#### 精简评论内容不需要把每个人@出来 +``` +配置文件加:no_need_to_notice:true +``` + +#### 精简但会@一个审查员 +``` +welcome-simper:true +``` \ No newline at end of file -- Gitee