chore: tweak debugging output

This commit is contained in:
2019-02-19 15:15:37 -07:00
parent 5c842eccff
commit 59a3ae4be7
2 changed files with 27 additions and 15 deletions

View File

@@ -41,19 +41,30 @@ async function ghActionBot() {
// keep track of comments that have been processed
history.add(comment);
logger.debug(`PROCESS COMMENT ON #${comment.number}`);
const pull = await getPull(repo, comment.number);
// filter out any closed pulls
if (pull.state !== 'open') {
logger.debug(`SKIP #${pull.number}: state is ${pull.state}`);
return false; // filter out any closed pulls
logger.debug(`SKIP PULL #${pull.number}: state is ${pull.state}`);
return false;
}
// filter on owner
if (PULL_AUTHOR_FILTER && pull.owner !== PULL_AUTHOR_FILTER) {
logger.debug(`SKIP #${pull.number}: author is ${pull.owner}`);
return false; // filter on owner
logger.debug(`SKIP PULL #${pull.number}: author is ${pull.owner}`);
return false;
}
// filter on label
if (PULL_LABEL_FILTER && !pull.labels.includes(PULL_LABEL_FILTER)) {
logger.debug(`SKIP #${pull.number}: labels are ${pull.labels.join(',')}`);
return false; // filter on label
logger.debug(
`SKIP PULL #${
pull.number
}: labels missing '${PULL_LABEL_FILTER}', found ${pull.labels.join(',')}`
);
return false;
}
return { comment, pull };
@@ -64,20 +75,18 @@ async function ghActionBot() {
pulls.map(async ({ pull, comment }) => {
const commit = await getCommits(repo, pull.number, true);
const buildStatus = await getCommitStatus(repo, commit.sha);
// do nothing if the build has not started, or is pending or successful
if (!buildStatus || buildStatus.state === 'pending' || buildStatus.state === 'success') {
logger.debug(`SKIP #${pull.number}: build status is ${buildStatus.state}`);
logger.debug(`SKIP PULL #${pull.number}: build status is ${buildStatus.state}`);
return false;
}
return { comment, pull, commit, buildStatus };
})
)).filter(Boolean);
if (records.length) {
logger.log(`Found ${records.length} outstanding failures`);
} else {
logger.debug(`Found ${records.length} outstanding failures`);
}
logger.log(`${records.length ? `Found ${records.length}` : `≧(´▽`)≦ No`} outstanding failures`);
await Promise.all(
records.map(record =>