1 Commits

Author SHA1 Message Date
d9fba56335 feat: fetch data for prs that need retest 2018-10-17 17:29:12 -07:00
2 changed files with 3 additions and 10 deletions

View File

@@ -1,4 +1,3 @@
import dotenv from 'dotenv';
import createRepo from './lib/create_repo.mjs';
import getComments from './lib/get_comments.mjs';
import getPull from './lib/get_pull.mjs';
@@ -6,20 +5,17 @@ import getCommits from './lib/get_commits.mjs';
import getCommitStatus from './lib/get_commit_status.mjs';
import History from './lib/history.mjs';
dotenv.config();
export default async function() {
// parse repo name from cli and create repo instance
const repo = createRepo(process.argv.splice(2)[0]);
const { COMMENT_BODY_REGEXP, COMMENT_BODY_REGEXP_FLAGS, COMMENT_ACTOR } = process.env;
// load the history module
const history = new History();
// fetch comment info from event stream, filter for only new comments
const comments = (await getComments(repo, {
body: new RegExp(COMMENT_BODY_REGEXP, COMMENT_BODY_REGEXP_FLAGS),
actor: COMMENT_ACTOR,
body: /build failed/i,
actor: 'elasticmachine',
})).filter(comment => !history.get(comment.id));
// read pull data, filter out any closed pulls

View File

@@ -8,11 +8,8 @@ function usageError() {
export default function(repo) {
if (typeof repo !== 'string' || repo.length === 0) usageError();
const settings = {
token: process.env.GITHUB_ACCESS_TOKEN,
};
const octo = new Octokat(settings);
const octo = new Octokat();
const [owner, name] = repo.split('/');
if (!owner || !name) usageError();