Skip to content

Commit

Permalink
fix: change label skip logic
Browse files Browse the repository at this point in the history
  • Loading branch information
kellertk committed Apr 24, 2020
1 parent 1c718ea commit 6bdf9c7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 9 additions & 2 deletions src/entrypoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,18 @@ async function processIssues(client, args) {
if (isLabeled(issue, staleLabel)) {
log.debug(`issue contains the stale label`);
const lastCommentTime = getLastCommentTime(issueTimelineEvents);
const stLabelTime = getLastLabelTime(issueTimelineEvents, staleLabel);
const staleLabelTime = getLastLabelTime(issueTimelineEvents, staleLabel);
const sTime = new Date(
lastCommentTime + MS_PER_DAY * args.daysBeforeClose
);
const staleLabelTime = stLabelTime === undefined ? sTime : stLabelTime;

// This happens when we can't determine the time of labeling stale
// but GitHub told us it has a stale label on it.
if (stLabelTime === undefined) {
log.warn('Skipping this issue');
return;
}

if (lastCommentTime > staleLabelTime) {
log.debug('issue was commented on after the label was applied');
if (args.dryrun) {
Expand Down
1 change: 0 additions & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ module.exports.getLastLabelTime = (events, label) => {
log.warn(
`Could not find a ${label} label event in this issue's timeline. Was this label renamed?`
);
log.warn('Skipping over this issue');
return undefined;
}
};
Expand Down

0 comments on commit 6bdf9c7

Please sign in to comment.