kaiyuanshe / osschat

Apache Open Source Software Chat BOT
https://oss.chat/dashboard/
Apache License 2.0
182 stars 45 forks source link

Enable `.github/osschat.yml` to store OSSChat configuration for consumer repos #179

Open huan opened 2 years ago

huan commented 2 years ago

By default, this plugin loads configuration from a given repository file. If the file doesn't exist, it loads configuration from the same path in the same owner's .github repository. — https://github.com/probot/octokit-plugin-config

// given that `.github/my-app.yml` in `octocat/hello-world` has the following ocntent
//
// comment: 'Thank you for creating the issue!'
//
const { config } = await octokit.config.get({
  owner: "octocat",
  repo: "hello-world",
  path: ".github/my-app.yml",
});
// config is now { comment: "Thank you for creating the issue!" }

// all options and returns
const { config, files } = await octokit.config.get({
  owner: "octocat",
  repo: "hello-world",
  path: ".github/my-app.yml",
  defaults: {
    comment: "Thank you for creating the issue!",
  },
  branch: "develop",
});
// files is an array of { owner, repo, path, config } objects

We can design a .github/osschat.yml for our osschat users to store their settings in this file so that osschat can be easier to be configured.

OSSChat .github/osschat.yml Proposal

chatops:
  room:
    - 12341234@chatroom
chatopera:
  faq: ./faq.yaml
  admins:
    - huan
    - mingyu

The above is a demo for this idea

See also: https://probot.github.io/api/latest/classes/context.html#config