Add default `github-bot.yml` config
This commit is contained in:
parent
600c9f1e62
commit
b01aae82a4
|
@ -0,0 +1,16 @@
|
||||||
|
new-pull-requests:
|
||||||
|
project-board:
|
||||||
|
name: 'Pipeline for QA'
|
||||||
|
review-column-name: 'REVIEW'
|
||||||
|
|
||||||
|
welcome-bot:
|
||||||
|
message: 'Thanks for making your first PR here!'
|
||||||
|
|
||||||
|
bounty-awaiting-approval:
|
||||||
|
project-board:
|
||||||
|
name: 'Status SOB Swarm'
|
||||||
|
approval-column-name: 'bounty-awaiting-approval'
|
||||||
|
|
||||||
|
slack:
|
||||||
|
notification:
|
||||||
|
room: 'status-hubot'
|
|
@ -0,0 +1,22 @@
|
||||||
|
// Description:
|
||||||
|
// Configuration-related functionality
|
||||||
|
//
|
||||||
|
// Dependencies:
|
||||||
|
// js-yaml: "^3.10.0"
|
||||||
|
//
|
||||||
|
// Author:
|
||||||
|
// PombeirP
|
||||||
|
|
||||||
|
module.exports = (robot, fileName) => {
|
||||||
|
// Get document, or throw exception on error
|
||||||
|
try {
|
||||||
|
const yaml = require('js-yaml');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
return yaml.safeLoad(fs.readFileSync(fileName, 'utf8'));
|
||||||
|
} catch (e) {
|
||||||
|
robot.log.error(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
|
@ -11,6 +11,7 @@
|
||||||
// PombeirP
|
// PombeirP
|
||||||
|
|
||||||
const getConfig = require('probot-config');
|
const getConfig = require('probot-config');
|
||||||
|
const defaultConfig = require('../lib/config.js');
|
||||||
const Slack = require('probot-slack-status');
|
const Slack = require('probot-slack-status');
|
||||||
|
|
||||||
let slackClient = null;
|
let slackClient = null;
|
||||||
|
@ -34,7 +35,7 @@ module.exports = function(robot) {
|
||||||
async function assignPullRequestToReview(context, robot) {
|
async function assignPullRequestToReview(context, robot) {
|
||||||
const payload = context.payload;
|
const payload = context.payload;
|
||||||
const github = context.github;
|
const github = context.github;
|
||||||
const config = await getConfig(context, 'github-bot.yml')
|
const config = await getConfig(context, 'github-bot.yml', defaultConfig(robot, '.github/github-bot.yml'))
|
||||||
const ownerName = payload.repository.owner.login;
|
const ownerName = payload.repository.owner.login;
|
||||||
const repoName = payload.repository.name;
|
const repoName = payload.repository.name;
|
||||||
const prNumber = payload.pull_request.number;
|
const prNumber = payload.pull_request.number;
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
// PombeirP
|
// PombeirP
|
||||||
|
|
||||||
const getConfig = require('probot-config');
|
const getConfig = require('probot-config');
|
||||||
|
const defaultConfig = require('../lib/config.js');
|
||||||
const Slack = require('probot-slack-status');
|
const Slack = require('probot-slack-status');
|
||||||
|
|
||||||
let slackClient = null;
|
let slackClient = null;
|
||||||
|
@ -34,7 +35,7 @@ module.exports = function(robot) {
|
||||||
async function assignIssueToBountyAwaitingForApproval(context, robot) {
|
async function assignIssueToBountyAwaitingForApproval(context, robot) {
|
||||||
const github = context.github;
|
const github = context.github;
|
||||||
const payload = context.payload;
|
const payload = context.payload;
|
||||||
const config = await getConfig(context, 'github-bot.yml')
|
const config = await getConfig(context, 'github-bot.yml', defaultConfig(robot, '.github/github-bot.yml'))
|
||||||
const ownerName = payload.repository.owner.login;
|
const ownerName = payload.repository.owner.login;
|
||||||
const repoName = payload.repository.name;
|
const repoName = payload.repository.name;
|
||||||
const issueNumber = payload.issue.number;
|
const issueNumber = payload.issue.number;
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
// PombeirP
|
// PombeirP
|
||||||
|
|
||||||
const getConfig = require('probot-config');
|
const getConfig = require('probot-config');
|
||||||
|
const defaultConfig = require('../lib/config.js');
|
||||||
const Slack = require('probot-slack-status');
|
const Slack = require('probot-slack-status');
|
||||||
|
|
||||||
let slackClient = null;
|
let slackClient = null;
|
||||||
|
@ -34,7 +35,7 @@ module.exports = function(robot) {
|
||||||
async function greetNewContributor(context, robot) {
|
async function greetNewContributor(context, robot) {
|
||||||
const payload = context.payload;
|
const payload = context.payload;
|
||||||
const github = context.github;
|
const github = context.github;
|
||||||
const config = await getConfig(context, 'github-bot.yml')
|
const config = await getConfig(context, 'github-bot.yml', defaultConfig(robot, '.github/github-bot.yml'))
|
||||||
const welcomeMessage = config['new-pull-requests']['welcome-bot'].message;
|
const welcomeMessage = config['new-pull-requests']['welcome-bot'].message;
|
||||||
const ownerName = payload.repository.owner.login;
|
const ownerName = payload.repository.owner.login;
|
||||||
const repoName = payload.repository.name;
|
const repoName = payload.repository.name;
|
||||||
|
|
Loading…
Reference in New Issue