Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

多仓库配置化 #45

Open
xuexb opened this issue Nov 9, 2017 · 3 comments
Open

多仓库配置化 #45

xuexb opened this issue Nov 9, 2017 · 3 comments
Assignees

Comments

@xuexb
Copy link
Owner

xuexb commented Nov 9, 2017

如:

{
  "config": {
    "github-bot": {
      "repo": {
        "issue": {
          "labelAutoReply": {
            "enabled": true,
            "data": {
              "need demo": "您好,请填写相关 Demo 链接。",
              "need update package": "请更新版本号。"
            }
          },
          "labelToAuthor": {
            "enabled": true,
            "data": {
              "bug": "xuexb",
              "enhancement": "xuexb",
              "question": "xuexb"
            }
          }
        },
        "pull-request": {
          "labelToReviewer": {
            "enabled": true,
            "data": {
              "bug": "xuexb"
            }
          }
        }
      }
    }
  }
}

遵循:

  1. 配置化
  2. 功能开关
  3. 多仓库
@yugasun
Copy link
Collaborator

yugasun commented Nov 14, 2017

@xuexb 如果是基于多仓库配置,那么在 package.jsonconfig 参数中新增 属性对象 reposrepos 对象的 key 均为 对象仓库名,当然,因为 github.js 中的 const GitHub = require('github') 是预先初始化公用的,所以配置的所有仓库 webhooksecret token,应保持一致,那么配置修改如下:

{
  "config": {
    "repos": {
      "github-bot": {
        "issue": {
          "labelAutoReply": {
            "enabled": true,
            "data": {
              "need demo": "您好,请填写相关 Demo 链接。",
              "need update package": "请更新版本号。"
            }
          },
          "labelToAuthor": {
            "enabled": true,
            "data": {
              "bug": "xuexb",
              "enhancement": "xuexb",
              "question": "xuexb"
            }
          }
        },
        "pull-request": {
          "labelToReviewer": {
            "enabled": true,
            "data": {
              "bug": "xuexb"
            }
          }
        }
      }
    }
  }
}

@xuexb
Copy link
Owner Author

xuexb commented Nov 14, 2017

hi @yugasunsecret token 保持一致这点我也认可,但我认为 config 的子级应该是 github-bot ,理由是:

  1. config 字段是公用的,下面应该对应到某个功能,而我们的功能就是 github-bot
  2. 使用 config['github-bot'] 即可获取对应的配置,如果想判断某个仓库是否有配置,可使用 config['github-bot'][repoName] 即可,比较方便。
  3. 项目应该是针对 github-bot 的,语义上理解就是说我们的机器人是一个“人”,她服务于多个仓库,而不是我有多个仓库,每个仓库都有一个机器人。

@yugasun
Copy link
Collaborator

yugasun commented Nov 14, 2017

@xuexb 非常赞同你的说法,那么就这么定了。

xuexb added a commit that referenced this issue Jan 21, 2018
@xuexb xuexb mentioned this issue Feb 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants