Compare commits
1 Commits
ec14a479c8
...
d9fba56335
| Author | SHA1 | Date | |
|---|---|---|---|
| d9fba56335 |
@@ -1,4 +1,3 @@
|
|||||||
import dotenv from 'dotenv';
|
|
||||||
import createRepo from './lib/create_repo.mjs';
|
import createRepo from './lib/create_repo.mjs';
|
||||||
import getComments from './lib/get_comments.mjs';
|
import getComments from './lib/get_comments.mjs';
|
||||||
import getPull from './lib/get_pull.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 getCommitStatus from './lib/get_commit_status.mjs';
|
||||||
import History from './lib/history.mjs';
|
import History from './lib/history.mjs';
|
||||||
|
|
||||||
dotenv.config();
|
|
||||||
|
|
||||||
export default async function() {
|
export default async function() {
|
||||||
// parse repo name from cli and create repo instance
|
// parse repo name from cli and create repo instance
|
||||||
const repo = createRepo(process.argv.splice(2)[0]);
|
const repo = createRepo(process.argv.splice(2)[0]);
|
||||||
const { COMMENT_BODY_REGEXP, COMMENT_BODY_REGEXP_FLAGS, COMMENT_ACTOR } = process.env;
|
|
||||||
|
|
||||||
// load the history module
|
// load the history module
|
||||||
const history = new History();
|
const history = new History();
|
||||||
|
|
||||||
// fetch comment info from event stream, filter for only new comments
|
// fetch comment info from event stream, filter for only new comments
|
||||||
const comments = (await getComments(repo, {
|
const comments = (await getComments(repo, {
|
||||||
body: new RegExp(COMMENT_BODY_REGEXP, COMMENT_BODY_REGEXP_FLAGS),
|
body: /build failed/i,
|
||||||
actor: COMMENT_ACTOR,
|
actor: 'elasticmachine',
|
||||||
})).filter(comment => !history.get(comment.id));
|
})).filter(comment => !history.get(comment.id));
|
||||||
|
|
||||||
// read pull data, filter out any closed pulls
|
// read pull data, filter out any closed pulls
|
||||||
|
|||||||
@@ -8,11 +8,8 @@ function usageError() {
|
|||||||
|
|
||||||
export default function(repo) {
|
export default function(repo) {
|
||||||
if (typeof repo !== 'string' || repo.length === 0) usageError();
|
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('/');
|
const [owner, name] = repo.split('/');
|
||||||
|
|
||||||
if (!owner || !name) usageError();
|
if (!owner || !name) usageError();
|
||||||
|
|||||||
Reference in New Issue
Block a user