Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,16 @@ const [
const updatedByDays = 3; // If last update update 3 days, the issue is considered updated
const commentByDays = 7; // If last update between 7 to 14 days ago, issue is outdated and needs update
const inactiveUpdatedByDays = 14; // If last update greater than 14 days ago, the issue is considered inactive
const upperLimitDays = 30; // Bot-generated comments older than this are not checked by minimizeComments()

const threeDayCutoffTime = new Date();
threeDayCutoffTime.setDate(threeDayCutoffTime.getDate() - updatedByDays);
const sevenDayCutoffTime = new Date();
sevenDayCutoffTime.setDate(sevenDayCutoffTime.getDate() - commentByDays);
const fourteenDayCutoffTime = new Date();
fourteenDayCutoffTime.setDate(fourteenDayCutoffTime.getDate() - inactiveUpdatedByDays);
const upperLimitCutoffTime = new Date();
upperLimitCutoffTime.setDate(upperLimitCutoffTime.getDate() - upperLimitDays);



Expand Down Expand Up @@ -184,8 +187,8 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an
lastAssignedTimestamp = eventTimestamp;
}

// If this event is more than 7 days old AND this event is a comment by the GitHub Actions Bot, then hide the comment as outdated.
if (!isMomentRecent(eventObj.created_at, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) {
// If this event is more than 7 days old but less than the upperLimitCutoffTime AND this event is a comment by the GitHub Actions Bot, then hide the comment as outdated.
if (isMomentRecent(eventObj.created_at, upperLimitCutoffTime) && !isMomentRecent(eventObj.created_at, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) {
console.log(`Comment ${eventObj.node_id} is outdated (i.e. > 7 days old) and will be minimized.`);
commentsToBeMinimized.push(eventObj.node_id); // retain node id so its associated comment can be minimized later
}
Expand Down