A configuration Manager for Probot
APACHE-2.0 License
A Probot plugin to manage configuration files effectively. Configuration files are validated by Joi and cached appropriately.
# models
import Joi = require("joi");
export interface IComment {
comment: string;
label: string;
}
export interface IConfig {
comments?: IComment[];
}
//
// comments:
// - label: needs-area
// comment: |
// There is no area label added to this issue/PR.
// Please add an area:<team> label
export const schema = Joi.object().keys({
comments: Joi.array().items(
Joi.object().keys({
comment: Joi.string(),
label: Joi.string()
})
)
});
import { IConfig, schema } from "./models";
const configManager = new ConfigManager<IConfig>("comment.yml", {}, schema);
app.on(events, async (context: Context) => {
const config = await configManager.getConfig(context).catch(err => {
context.log.error(err);
return {} as IConfig;
});
});
If you have suggestions for how this bot could be improved, or want to report a bug, open an issue! We'd love all and any contributions.