Add default `github-bot.yml` config

This commit is contained in:
Pedro Pombeiro 2018-01-22 18:22:32 +01:00
parent 600c9f1e62
commit b01aae82a4
No known key found for this signature in database
GPG Key ID: A65DEB11E4BBC647
5 changed files with 44 additions and 3 deletions

16
.github/github-bot.yml vendored Normal file
View File

@ -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'

22
lib/config.js Normal file
View File

@ -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;
}

View File

@ -11,6 +11,7 @@
// PombeirP
const getConfig = require('probot-config');
const defaultConfig = require('../lib/config.js');
const Slack = require('probot-slack-status');
let slackClient = null;
@ -34,7 +35,7 @@ module.exports = function(robot) {
async function assignPullRequestToReview(context, robot) {
const payload = context.payload;
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 repoName = payload.repository.name;
const prNumber = payload.pull_request.number;

View File

@ -11,6 +11,7 @@
// PombeirP
const getConfig = require('probot-config');
const defaultConfig = require('../lib/config.js');
const Slack = require('probot-slack-status');
let slackClient = null;
@ -34,7 +35,7 @@ module.exports = function(robot) {
async function assignIssueToBountyAwaitingForApproval(context, robot) {
const github = context.github;
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 repoName = payload.repository.name;
const issueNumber = payload.issue.number;

View File

@ -11,6 +11,7 @@
// PombeirP
const getConfig = require('probot-config');
const defaultConfig = require('../lib/config.js');
const Slack = require('probot-slack-status');
let slackClient = null;
@ -34,7 +35,7 @@ module.exports = function(robot) {
async function greetNewContributor(context, robot) {
const payload = context.payload;
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 ownerName = payload.repository.owner.login;
const repoName = payload.repository.name;