Skip to content

Commit 103eb9d

Browse files
committed
Follow up fixes to #95 for #92
1 parent db79af5 commit 103eb9d

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

functions/src/cron.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ export class CronHandler {
6161
[issueConfig.label_needs_info]
6262
);
6363

64+
log.debug(
65+
`preProcessIssues: ${needsInfoIssues.length} issues witth label ${issueConfig.label_needs_info}`
66+
);
6467
for (const issue of needsInfoIssues) {
6568
const issueActions = await this.doubleCheckNeedsInfo(
6669
org,
@@ -290,6 +293,11 @@ export class CronHandler {
290293
let comments = await this.gh_client.getCommentsForIssue(org, name, number);
291294
comments = comments.sort(util.compareTimestamps).reverse();
292295

296+
if (!comments || comments.length === 0) {
297+
console.log(`Issue ${name}#${number} has no comments.`);
298+
return actions;
299+
}
300+
293301
// When the issue was marked stale, the bot will have left a comment with certain metadata
294302
const markStaleComment = comments.find(comment => {
295303
return comment.body.includes(EVT_MARK_STALE);

functions/src/github.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,17 @@ export class GitHubClient {
177177
state?: IssueState,
178178
labels?: string[]
179179
) {
180-
const stateFilter = state || "all";
181-
const labelsFilter = labels === undefined ? undefined : labels.join(",");
182-
183-
return paginate(this.api.issues.listForRepo, {
180+
const opts: any = {
184181
owner,
185182
repo,
186-
state: stateFilter,
187-
labels: labelsFilter
188-
});
183+
state: state || "all"
184+
};
185+
186+
if (labels && labels.length > 0) {
187+
opts.labels = labels.join(",");
188+
}
189+
190+
return paginate(this.api.issues.listForRepo, opts);
189191
}
190192

191193
/**

0 commit comments

Comments
 (0)