From 4d439c6e38c0c2ae672ba11065ab4365c5d47223 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Sun, 3 Mar 2024 14:52:45 -0800 Subject: [PATCH 01/96] Added workflow_dispatch trigger to schedule-fri-0700.yml --- .github/workflows/schedule-fri-0700.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/schedule-fri-0700.yml b/.github/workflows/schedule-fri-0700.yml index 3df0c6fe1f..c236d40760 100644 --- a/.github/workflows/schedule-fri-0700.yml +++ b/.github/workflows/schedule-fri-0700.yml @@ -3,6 +3,7 @@ name: Schedule Friday 0700 on: schedule: - cron: '0 7 * * 5' + workflow_dispatch: jobs: Add-Update-Label-to-Issues-Weekly: From 49efa4a9d299b462643094941c7c1fc0846c3f7c Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Sun, 3 Mar 2024 20:36:06 -0800 Subject: [PATCH 02/96] Added function outline for helper function that determines if a bot wrote a comment --- .../trigger-schedule/add-update-label-weekly/add-label.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 35cf65c188..46b1807ad5 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -293,4 +293,8 @@ function formatComment(assignees, labelString) { return completedInstuctions } +function isCommentByBot(data, botLogin) { + +} + module.exports = main From 76a8b84dd3a54a5679a137f1c393756f4247ec6f Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Sun, 3 Mar 2024 20:40:58 -0800 Subject: [PATCH 03/96] Added boolean statement to isCommentByBot helper function --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 46b1807ad5..2330806038 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -294,7 +294,7 @@ function formatComment(assignees, labelString) { } function isCommentByBot(data, botLogin) { - + return data.actor.login === botLogin; } module.exports = main From ad9f0035b9755b7fa7d3cfec3b23da5cebb25461 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Sun, 3 Mar 2024 20:43:22 -0800 Subject: [PATCH 04/96] Added line to test output of github action in working branch --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 2330806038..fc14e8ff00 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -110,6 +110,8 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an let lastAssignedTimestamp = null; let lastCommentTimestamp = null; + console.log("Hello GitHub Action World!"); + for (let i = timeline.length - 1; i >= 0; i--) { let eventObj = timeline[i]; let eventType = eventObj.event; From d1e47a162ae81eb55401ca8008dfd8cc2b23e378 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Sun, 3 Mar 2024 20:44:54 -0800 Subject: [PATCH 05/96] Moved testing output line --- .../trigger-schedule/add-update-label-weekly/add-label.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index fc14e8ff00..cddca754ac 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -28,6 +28,7 @@ fourteenDayCutoffTime.setDate(fourteenDayCutoffTime.getDate() - inactiveUpdatedB * @param {Number} columnId a number presenting a specific column to examine, supplied by GitHub secrets */ async function main({ g, c }, columnId) { + console.log("Hello GitHub Action World!"); github = g; context = c; // Retrieve all issue numbers from a column @@ -110,8 +111,6 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an let lastAssignedTimestamp = null; let lastCommentTimestamp = null; - console.log("Hello GitHub Action World!"); - for (let i = timeline.length - 1; i >= 0; i--) { let eventObj = timeline[i]; let eventType = eventObj.event; From eae7b648b87ba3b1c1df785331226522d8987b85 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Mon, 4 Mar 2024 18:15:45 -0800 Subject: [PATCH 06/96] Set a new commentByDays for testing purposes --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index cddca754ac..392e3de282 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -10,7 +10,7 @@ const toUpdateLabel = 'To Update !'; const inactiveLabel = '2 weeks inactive'; const updatedByDays = 3; // If there is an update within 3 days, the issue is considered updated const inactiveUpdatedByDays = 14; // If no update within 14 days, the issue is considered '2 weeks inactive' -const commentByDays = 7; // If there is an update within 14 days but no update within 7 days, the issue is considered outdated and the assignee needs 'To Update !' it +const commentByDays = -1; // If there is an update within 14 days but no update within 7 days, the issue is considered outdated and the assignee needs 'To Update !' it. Set to -1 for testing purposes only const threeDayCutoffTime = new Date() threeDayCutoffTime.setDate(threeDayCutoffTime.getDate() - updatedByDays) const sevenDayCutoffTime = new Date() From f8a43bcc9e162dd7e05e1b207179651564a5056c Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Mon, 4 Mar 2024 18:19:45 -0800 Subject: [PATCH 07/96] Reverted last change --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 392e3de282..4f4443f9a0 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -10,7 +10,7 @@ const toUpdateLabel = 'To Update !'; const inactiveLabel = '2 weeks inactive'; const updatedByDays = 3; // If there is an update within 3 days, the issue is considered updated const inactiveUpdatedByDays = 14; // If no update within 14 days, the issue is considered '2 weeks inactive' -const commentByDays = -1; // If there is an update within 14 days but no update within 7 days, the issue is considered outdated and the assignee needs 'To Update !' it. Set to -1 for testing purposes only +const commentByDays = 7; // If there is an update within 14 days but no update within 7 days, the issue is considered outdated and the assignee needs 'To Update !' it. const threeDayCutoffTime = new Date() threeDayCutoffTime.setDate(threeDayCutoffTime.getDate() - updatedByDays) const sevenDayCutoffTime = new Date() From 01d418e846cced936e6ed936b6469caf0bfe700d Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Mon, 4 Mar 2024 18:22:43 -0800 Subject: [PATCH 08/96] Made edits for testing purposes --- .../trigger-schedule/add-update-label-weekly/add-label.js | 1 + 1 file changed, 1 insertion(+) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 4f4443f9a0..5f5c936da8 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -14,6 +14,7 @@ const commentByDays = 7; // If there is an update within 14 days but no update w const threeDayCutoffTime = new Date() threeDayCutoffTime.setDate(threeDayCutoffTime.getDate() - updatedByDays) const sevenDayCutoffTime = new Date() +sevenDayCutoffTime.setDate(sevenDayCutoffTime.getDate() + 10); // for testing purposes, let's pretend it's 10 days from today. sevenDayCutoffTime.setDate(sevenDayCutoffTime.getDate() - commentByDays) const fourteenDayCutoffTime = new Date() fourteenDayCutoffTime.setDate(fourteenDayCutoffTime.getDate() - inactiveUpdatedByDays) From 16fd6d05f56c5e8215dfa1bb9b94b4817b40b8f8 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Mon, 4 Mar 2024 18:24:28 -0800 Subject: [PATCH 09/96] Made small edit to that edit --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 5f5c936da8..fd40a00071 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -14,7 +14,7 @@ const commentByDays = 7; // If there is an update within 14 days but no update w const threeDayCutoffTime = new Date() threeDayCutoffTime.setDate(threeDayCutoffTime.getDate() - updatedByDays) const sevenDayCutoffTime = new Date() -sevenDayCutoffTime.setDate(sevenDayCutoffTime.getDate() + 10); // for testing purposes, let's pretend it's 10 days from today. +sevenDayCutoffTime.setDate(sevenDayCutoffTime.getDate() - 10); // for testing purposes, let's pretend it's 10 days before today. sevenDayCutoffTime.setDate(sevenDayCutoffTime.getDate() - commentByDays) const fourteenDayCutoffTime = new Date() fourteenDayCutoffTime.setDate(fourteenDayCutoffTime.getDate() - inactiveUpdatedByDays) From c32ae778d42850eca037ad1fcf5e176f0b3cc320 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Mon, 4 Mar 2024 19:32:24 -0800 Subject: [PATCH 10/96] Reverted the edits --- .../trigger-schedule/add-update-label-weekly/add-label.js | 1 - 1 file changed, 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index fd40a00071..4f4443f9a0 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -14,7 +14,6 @@ const commentByDays = 7; // If there is an update within 14 days but no update w const threeDayCutoffTime = new Date() threeDayCutoffTime.setDate(threeDayCutoffTime.getDate() - updatedByDays) const sevenDayCutoffTime = new Date() -sevenDayCutoffTime.setDate(sevenDayCutoffTime.getDate() - 10); // for testing purposes, let's pretend it's 10 days before today. sevenDayCutoffTime.setDate(sevenDayCutoffTime.getDate() - commentByDays) const fourteenDayCutoffTime = new Date() fourteenDayCutoffTime.setDate(fourteenDayCutoffTime.getDate() - inactiveUpdatedByDays) From b23895d45ab8a2307dec5390f76f21a7d6b4707f Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Mon, 4 Mar 2024 19:49:11 -0800 Subject: [PATCH 11/96] Made edits to eventTimestamp to pretend that timestamps are 8 days in the past for testing purposes --- .../trigger-schedule/add-update-label-weekly/add-label.js | 1 + 1 file changed, 1 insertion(+) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 4f4443f9a0..c002aa7d1c 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -132,6 +132,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } let eventTimestamp = eventObj.updated_at || eventObj.created_at; + eventTimestamp = new Date(new Date(eventTimestamp) - 8).toDateString(); // pretend the eventTimestamp is 8 days ago for testing purposes // update the lastCommentTimestamp if this is the last (most recent) comment by an assignee if (!lastCommentTimestamp && eventType === 'commented' && isCommentByAssignees(eventObj, assignees)) { From 61ab7caeef8732031f81918080d1124f89267efc Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Mon, 4 Mar 2024 19:51:28 -0800 Subject: [PATCH 12/96] added debug line for eventTimestamp edit --- .../trigger-schedule/add-update-label-weekly/add-label.js | 1 + 1 file changed, 1 insertion(+) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index c002aa7d1c..da561adb5b 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -133,6 +133,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an let eventTimestamp = eventObj.updated_at || eventObj.created_at; eventTimestamp = new Date(new Date(eventTimestamp) - 8).toDateString(); // pretend the eventTimestamp is 8 days ago for testing purposes + console.log(eventTimestamp); // update the lastCommentTimestamp if this is the last (most recent) comment by an assignee if (!lastCommentTimestamp && eventType === 'commented' && isCommentByAssignees(eventObj, assignees)) { From 4959c82ee97cba932ca46be25648855a510f58b4 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Mon, 4 Mar 2024 19:53:49 -0800 Subject: [PATCH 13/96] Added another debug line in main() --- .../trigger-schedule/add-update-label-weekly/add-label.js | 1 + 1 file changed, 1 insertion(+) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index da561adb5b..317b535a2c 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -42,6 +42,7 @@ async function main({ g, c }, columnId) { console.log(`Assignee not found, skipping issue #${issueNum}`) continue } + console.log("we getting here?"); // Add and remove labels as well as post comment if the issue's timeline indicates the issue is inactive, to be updated or up to date accordingly const responseObject = await isTimelineOutdated(timeline, issueNum, assignees) From 3059ce57ce31273b51c985db00673c1c80dc2428 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Mon, 4 Mar 2024 19:56:34 -0800 Subject: [PATCH 14/96] Added another debug line in main() --- .../trigger-schedule/add-update-label-weekly/add-label.js | 1 + 1 file changed, 1 insertion(+) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 317b535a2c..064129c927 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -33,6 +33,7 @@ async function main({ g, c }, columnId) { context = c; // Retrieve all issue numbers from a column const issueNums = getIssueNumsFromColumn(columnId); + console.log("Issue numbers: " + issueNums.join(", ")); for await (let issueNum of issueNums) { const timeline = await getTimeline(issueNum, github, context); const timelineArray = Array.from(timeline); From 9aa7db7ae27c4036be297a50d8b74b1cab55e588 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Mon, 4 Mar 2024 19:57:27 -0800 Subject: [PATCH 15/96] Made edit to last debug line --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 064129c927..e4c05bac01 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -33,7 +33,7 @@ async function main({ g, c }, columnId) { context = c; // Retrieve all issue numbers from a column const issueNums = getIssueNumsFromColumn(columnId); - console.log("Issue numbers: " + issueNums.join(", ")); + console.log(issueNums); for await (let issueNum of issueNums) { const timeline = await getTimeline(issueNum, github, context); const timelineArray = Array.from(timeline); From d5ce01a58494af67d6c83dbcf483e9705ba47b4b Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Mon, 4 Mar 2024 19:58:43 -0800 Subject: [PATCH 16/96] Added yet another debug line to main() --- .../trigger-schedule/add-update-label-weekly/add-label.js | 1 + 1 file changed, 1 insertion(+) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index e4c05bac01..6d714d4158 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -33,6 +33,7 @@ async function main({ g, c }, columnId) { context = c; // Retrieve all issue numbers from a column const issueNums = getIssueNumsFromColumn(columnId); + console.log(columnId); console.log(issueNums); for await (let issueNum of issueNums) { const timeline = await getTimeline(issueNum, github, context); From 622372c7c2fdc77feb08954a7e72e208c908a181 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Mon, 4 Mar 2024 20:16:41 -0800 Subject: [PATCH 17/96] Setting columnId myself instead of using a secret for testing purposes --- .../trigger-schedule/add-update-label-weekly/add-label.js | 1 + 1 file changed, 1 insertion(+) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 6d714d4158..b9888f8ee1 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -31,6 +31,7 @@ async function main({ g, c }, columnId) { console.log("Hello GitHub Action World!"); github = g; context = c; + columnId = 6; // Retrieve all issue numbers from a column const issueNums = getIssueNumsFromColumn(columnId); console.log(columnId); From e28a5f79941eaf4c37fa5405e52f485bdc3403bd Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Mon, 4 Mar 2024 20:26:22 -0800 Subject: [PATCH 18/96] whatever --- .../trigger-schedule/add-update-label-weekly/add-label.js | 1 - 1 file changed, 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index b9888f8ee1..80c2dc2941 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -28,7 +28,6 @@ fourteenDayCutoffTime.setDate(fourteenDayCutoffTime.getDate() - inactiveUpdatedB * @param {Number} columnId a number presenting a specific column to examine, supplied by GitHub secrets */ async function main({ g, c }, columnId) { - console.log("Hello GitHub Action World!"); github = g; context = c; columnId = 6; From d1083fb7df0ec65c26b7eb3aa2defa933679f41a Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Mon, 4 Mar 2024 20:27:33 -0800 Subject: [PATCH 19/96] Just work please --- .../trigger-schedule/add-update-label-weekly/add-label.js | 1 - 1 file changed, 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 80c2dc2941..bbb1202181 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -30,7 +30,6 @@ fourteenDayCutoffTime.setDate(fourteenDayCutoffTime.getDate() - inactiveUpdatedB async function main({ g, c }, columnId) { github = g; context = c; - columnId = 6; // Retrieve all issue numbers from a column const issueNums = getIssueNumsFromColumn(columnId); console.log(columnId); From baf2b5d44419708353e5fc65d37e9536743869ca Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 5 Mar 2024 18:16:09 -0800 Subject: [PATCH 20/96] edited line that's supposed to set eventTimeStamp to 8 days before the real time stamp --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index bbb1202181..c1a21a583d 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -134,7 +134,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } let eventTimestamp = eventObj.updated_at || eventObj.created_at; - eventTimestamp = new Date(new Date(eventTimestamp) - 8).toDateString(); // pretend the eventTimestamp is 8 days ago for testing purposes + eventTimestamp = new Date((new Date(eventTimestamp).getDate() - 8).toDateString()).toDateString(); // pretend the eventTimestamp is 8 days ago for testing purposes console.log(eventTimestamp); // update the lastCommentTimestamp if this is the last (most recent) comment by an assignee From 2cec537d24dd0473f93ebfe83ab2077d664d0772 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 5 Mar 2024 18:20:11 -0800 Subject: [PATCH 21/96] this time? --- .../trigger-schedule/add-update-label-weekly/add-label.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index c1a21a583d..2393e93d5c 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -134,7 +134,8 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } let eventTimestamp = eventObj.updated_at || eventObj.created_at; - eventTimestamp = new Date((new Date(eventTimestamp).getDate() - 8).toDateString()).toDateString(); // pretend the eventTimestamp is 8 days ago for testing purposes + eventTimestamp = new Date().setDate(new Date(eventTimestamp).getDate() - 8); + eventTimestamp = eventTimestamp.toDateString(); // pretend the eventTimestamp is 8 days ago for testing purposes console.log(eventTimestamp); // update the lastCommentTimestamp if this is the last (most recent) comment by an assignee From a2c9f6949d7f7bd78cf5e79229afe11829a6126b Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 5 Mar 2024 18:21:11 -0800 Subject: [PATCH 22/96] this time? --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 2393e93d5c..cc875d22cb 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -135,7 +135,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an let eventTimestamp = eventObj.updated_at || eventObj.created_at; eventTimestamp = new Date().setDate(new Date(eventTimestamp).getDate() - 8); - eventTimestamp = eventTimestamp.toDateString(); // pretend the eventTimestamp is 8 days ago for testing purposes + eventTimestamp = eventTimestamp.toString(); // pretend the eventTimestamp is 8 days ago for testing purposes console.log(eventTimestamp); // update the lastCommentTimestamp if this is the last (most recent) comment by an assignee From 20d7676d3c99a59c42f6deea3106b3c09d489fc9 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 5 Mar 2024 18:21:51 -0800 Subject: [PATCH 23/96] this time again? --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index cc875d22cb..f0b1eaf880 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -134,7 +134,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } let eventTimestamp = eventObj.updated_at || eventObj.created_at; - eventTimestamp = new Date().setDate(new Date(eventTimestamp).getDate() - 8); + eventTimestamp = (new Date()).setDate((new Date(eventTimestamp)).getDate - 8); eventTimestamp = eventTimestamp.toString(); // pretend the eventTimestamp is 8 days ago for testing purposes console.log(eventTimestamp); From 538cfda5ac2e43febd8224e914a875da3de67512 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 5 Mar 2024 20:00:45 -0800 Subject: [PATCH 24/96] Added () to .getDate() --- .../trigger-schedule/add-update-label-weekly/add-label.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index f0b1eaf880..f4bdf5630e 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -134,9 +134,9 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } let eventTimestamp = eventObj.updated_at || eventObj.created_at; - eventTimestamp = (new Date()).setDate((new Date(eventTimestamp)).getDate - 8); + eventTimestamp = (new Date()).setDate((new Date(eventTimestamp)).getDate() - 8); eventTimestamp = eventTimestamp.toString(); // pretend the eventTimestamp is 8 days ago for testing purposes - console.log(eventTimestamp); + console.log("eventTimestamp: " + eventTimestamp); // update the lastCommentTimestamp if this is the last (most recent) comment by an assignee if (!lastCommentTimestamp && eventType === 'commented' && isCommentByAssignees(eventObj, assignees)) { From e1185d8d427165d631110b57468f94f147b8ef97 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 5 Mar 2024 20:02:30 -0800 Subject: [PATCH 25/96] Added better formatting for eventTypestamp debug --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index f4bdf5630e..3aac49c58d 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -136,7 +136,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an let eventTimestamp = eventObj.updated_at || eventObj.created_at; eventTimestamp = (new Date()).setDate((new Date(eventTimestamp)).getDate() - 8); eventTimestamp = eventTimestamp.toString(); // pretend the eventTimestamp is 8 days ago for testing purposes - console.log("eventTimestamp: " + eventTimestamp); + console.log("eventTimestamp: " + (new Date(eventTimestamp).toDateString())); // update the lastCommentTimestamp if this is the last (most recent) comment by an assignee if (!lastCommentTimestamp && eventType === 'commented' && isCommentByAssignees(eventObj, assignees)) { From 2647e0cd4d7ec8c37b2539b15ea8dec7bd5284aa Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 5 Mar 2024 20:09:52 -0800 Subject: [PATCH 26/96] now will the timestamp show correctly? --- .../trigger-schedule/add-update-label-weekly/add-label.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 3aac49c58d..c34ed7b202 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -136,8 +136,9 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an let eventTimestamp = eventObj.updated_at || eventObj.created_at; eventTimestamp = (new Date()).setDate((new Date(eventTimestamp)).getDate() - 8); eventTimestamp = eventTimestamp.toString(); // pretend the eventTimestamp is 8 days ago for testing purposes - console.log("eventTimestamp: " + (new Date(eventTimestamp).toDateString())); - + let formattedTimeStamp = new Date(); + formattedTimeStamp.setTime(eventTimestamp); + console.log("eventTimestamp: " + formattedTimeStamp); // update the lastCommentTimestamp if this is the last (most recent) comment by an assignee if (!lastCommentTimestamp && eventType === 'commented' && isCommentByAssignees(eventObj, assignees)) { lastCommentTimestamp = eventTimestamp; From 8ae85df093eafb19380400bddc510849ddc2c2d1 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 5 Mar 2024 20:13:06 -0800 Subject: [PATCH 27/96] Updated testing timing for timestamps --- .../trigger-schedule/add-update-label-weekly/add-label.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index c34ed7b202..7e52d650cf 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -134,8 +134,8 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } let eventTimestamp = eventObj.updated_at || eventObj.created_at; - eventTimestamp = (new Date()).setDate((new Date(eventTimestamp)).getDate() - 8); - eventTimestamp = eventTimestamp.toString(); // pretend the eventTimestamp is 8 days ago for testing purposes + eventTimestamp = (new Date()).setDate((new Date(eventTimestamp)).getDate() - 6); + eventTimestamp = eventTimestamp.toString(); // pretend the eventTimestamp is 6 days before what it really is for testing purposes let formattedTimeStamp = new Date(); formattedTimeStamp.setTime(eventTimestamp); console.log("eventTimestamp: " + formattedTimeStamp); From cead392e551bf58ec8ac79078879b3a759f12539 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 5 Mar 2024 20:17:23 -0800 Subject: [PATCH 28/96] Changed to 0 --- .../trigger-schedule/add-update-label-weekly/add-label.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 7e52d650cf..cf13f86668 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -134,8 +134,8 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } let eventTimestamp = eventObj.updated_at || eventObj.created_at; - eventTimestamp = (new Date()).setDate((new Date(eventTimestamp)).getDate() - 6); - eventTimestamp = eventTimestamp.toString(); // pretend the eventTimestamp is 6 days before what it really is for testing purposes + eventTimestamp = (new Date()).setDate((new Date(eventTimestamp)).getDate() - 0); + eventTimestamp = eventTimestamp.toString(); // pretend the eventTimestamp is 0 days before what it really is for testing purposes let formattedTimeStamp = new Date(); formattedTimeStamp.setTime(eventTimestamp); console.log("eventTimestamp: " + formattedTimeStamp); From d287f562863bd4927331fac853b5266f92655640 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 5 Mar 2024 20:21:05 -0800 Subject: [PATCH 29/96] Let's see what the eventTimestamp is by default --- .../add-update-label-weekly/add-label.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index cf13f86668..bea084553f 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -134,11 +134,10 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } let eventTimestamp = eventObj.updated_at || eventObj.created_at; - eventTimestamp = (new Date()).setDate((new Date(eventTimestamp)).getDate() - 0); - eventTimestamp = eventTimestamp.toString(); // pretend the eventTimestamp is 0 days before what it really is for testing purposes - let formattedTimeStamp = new Date(); - formattedTimeStamp.setTime(eventTimestamp); - console.log("eventTimestamp: " + formattedTimeStamp); + console.log(eventObj.updated_at); + console.log(eventObj.created_at); + console.log(eventTimestamp); + // update the lastCommentTimestamp if this is the last (most recent) comment by an assignee if (!lastCommentTimestamp && eventType === 'commented' && isCommentByAssignees(eventObj, assignees)) { lastCommentTimestamp = eventTimestamp; From d6bc37dac86d7137339755749199541344dda396 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 5 Mar 2024 20:26:53 -0800 Subject: [PATCH 30/96] Added additional debug logging to eventTimestamp --- .../trigger-schedule/add-update-label-weekly/add-label.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index bea084553f..9c22dcedf2 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -134,9 +134,9 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } let eventTimestamp = eventObj.updated_at || eventObj.created_at; - console.log(eventObj.updated_at); - console.log(eventObj.created_at); - console.log(eventTimestamp); + console.log("Updated at: " + eventObj.updated_at); + console.log("Created at: " + eventObj.created_at); + console.log("eventTimestamp: " + eventTimestamp); // update the lastCommentTimestamp if this is the last (most recent) comment by an assignee if (!lastCommentTimestamp && eventType === 'commented' && isCommentByAssignees(eventObj, assignees)) { From 7ca00440066a8eb23edf4693bd3bbe0b11fb66a2 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 5 Mar 2024 20:30:11 -0800 Subject: [PATCH 31/96] Modified formatting --- .../trigger-schedule/add-update-label-weekly/add-label.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 9c22dcedf2..8d61cd643c 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -134,9 +134,8 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } let eventTimestamp = eventObj.updated_at || eventObj.created_at; - console.log("Updated at: " + eventObj.updated_at); - console.log("Created at: " + eventObj.created_at); - console.log("eventTimestamp: " + eventTimestamp); + let formattedEventTimestamp = new Date(eventTimestamp).toDateString(); + console.log("Formatted eventTimestamp: " + formattedEventTimestamp); // update the lastCommentTimestamp if this is the last (most recent) comment by an assignee if (!lastCommentTimestamp && eventType === 'commented' && isCommentByAssignees(eventObj, assignees)) { From 475aad266fbb9c21495498dfa76fb97f0bb32c3f Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 5 Mar 2024 20:31:24 -0800 Subject: [PATCH 32/96] and again! --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 8d61cd643c..5ae3cc62bd 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -134,7 +134,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } let eventTimestamp = eventObj.updated_at || eventObj.created_at; - let formattedEventTimestamp = new Date(eventTimestamp).toDateString(); + let formattedEventTimestamp = new Date(eventTimestamp).toString(); console.log("Formatted eventTimestamp: " + formattedEventTimestamp); // update the lastCommentTimestamp if this is the last (most recent) comment by an assignee From bba1ed8ba3d5412759e97db9213a2c891f038b56 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Wed, 6 Mar 2024 20:12:21 -0800 Subject: [PATCH 33/96] Let's figure out the exact type of eventTimeStamp --- .../trigger-schedule/add-update-label-weekly/add-label.js | 1 + 1 file changed, 1 insertion(+) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 5ae3cc62bd..c6e21e55ca 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -134,6 +134,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } let eventTimestamp = eventObj.updated_at || eventObj.created_at; + console.log(typeof(eventTimestamp)); let formattedEventTimestamp = new Date(eventTimestamp).toString(); console.log("Formatted eventTimestamp: " + formattedEventTimestamp); From 1ae247f91e16bb1a2aa0bf22eaee60113f2dde17 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Wed, 6 Mar 2024 20:15:10 -0800 Subject: [PATCH 34/96] Wrote new code to change the dates for testing purposes --- .../trigger-schedule/add-update-label-weekly/add-label.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index c6e21e55ca..352240af36 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -134,8 +134,10 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } let eventTimestamp = eventObj.updated_at || eventObj.created_at; - console.log(typeof(eventTimestamp)); let formattedEventTimestamp = new Date(eventTimestamp).toString(); + let eventTimestampDate = new Date(eventTimestamp); + eventTimestampDate.setDate(eventTimestampDate.getDate() - 8); // pretend timestamps are 8 days before they really are for testing purposes + eventTimestamp = eventTimestamp.toString(); console.log("Formatted eventTimestamp: " + formattedEventTimestamp); // update the lastCommentTimestamp if this is the last (most recent) comment by an assignee From 2381d656df1f922fac6471305e7ccd5439708cf1 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Wed, 6 Mar 2024 20:16:27 -0800 Subject: [PATCH 35/96] There, now it should work. --- .../trigger-schedule/add-update-label-weekly/add-label.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 352240af36..9ee5030ef8 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -134,10 +134,10 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } let eventTimestamp = eventObj.updated_at || eventObj.created_at; - let formattedEventTimestamp = new Date(eventTimestamp).toString(); let eventTimestampDate = new Date(eventTimestamp); eventTimestampDate.setDate(eventTimestampDate.getDate() - 8); // pretend timestamps are 8 days before they really are for testing purposes - eventTimestamp = eventTimestamp.toString(); + eventTimestamp = eventTimestampDate.toString(); + let formattedEventTimestamp = new Date(eventTimestamp).toString(); console.log("Formatted eventTimestamp: " + formattedEventTimestamp); // update the lastCommentTimestamp if this is the last (most recent) comment by an assignee From 7998a29ca1e7c7a3481604a62fd359afd940f563 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Wed, 6 Mar 2024 20:20:37 -0800 Subject: [PATCH 36/96] Logging timeline so I can understand its structure --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 9ee5030ef8..4d6a917ffa 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -113,6 +113,8 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an let lastAssignedTimestamp = null; let lastCommentTimestamp = null; + console.log(timeline); + for (let i = timeline.length - 1; i >= 0; i--) { let eventObj = timeline[i]; let eventType = eventObj.event; From 74234953e5782e2bbeffcb8435e29bfeeddf1983 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Thu, 7 Mar 2024 19:58:48 -0800 Subject: [PATCH 37/96] Added preliminary code for hiding comments --- .../add-update-label-weekly/add-label.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 4d6a917ffa..1c286fb106 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -113,8 +113,6 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an let lastAssignedTimestamp = null; let lastCommentTimestamp = null; - console.log(timeline); - for (let i = timeline.length - 1; i >= 0; i--) { let eventObj = timeline[i]; let eventType = eventObj.event; @@ -181,6 +179,18 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an return { result: true, labels: toUpdateLabel } // outdated, add 'To Update!' label } + if (!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. + console.log("Comment create more than 7 days ago. Hiding as outdated..."); + github.rest.issues.getComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: eventObj.id + }) + .then((comment) => { + console.log(comment); + }); + } + // if no comment or assigning found within 14 days, issue is outdated and add '2 weeks inactive' label console.log(`Issue #${issueNum} has no update within 14 days, use '2 weeks inactive' label`) return { result: true, labels: inactiveLabel } @@ -303,7 +313,8 @@ function formatComment(assignees, labelString) { return completedInstuctions } -function isCommentByBot(data, botLogin) { +function isCommentByBot(data) { + let botLogin = "github-actions[bot]"; return data.actor.login === botLogin; } From 7034f8ec44f3ec8aefc6fa190a921a6eab60aeb7 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Thu, 7 Mar 2024 20:06:47 -0800 Subject: [PATCH 38/96] let's test moment is recent --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 1c286fb106..66b1dd04d3 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -179,6 +179,8 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an return { result: true, labels: toUpdateLabel } // outdated, add 'To Update!' label } + let momentIsRecent = isMomentRecent(eventTimestamp, sevenDayCutoffTime); + console.log(momentIsRecent); if (!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. console.log("Comment create more than 7 days ago. Hiding as outdated..."); github.rest.issues.getComment({ From 71a814b071ea8f83b214252a270e777772794c34 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Thu, 7 Mar 2024 20:08:23 -0800 Subject: [PATCH 39/96] Change the placement of the new if statement so it actually gets triggered --- .../add-update-label-weekly/add-label.js | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 66b1dd04d3..580d9f7a5b 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -149,6 +149,18 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an else if (!lastAssignedTimestamp && eventType === 'assigned' && assignees.includes(eventObj.assignee.login)) { lastAssignedTimestamp = eventTimestamp; } + + if (!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. + console.log("Comment create more than 7 days ago. Hiding as outdated..."); + github.rest.issues.getComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: eventObj.id + }) + .then((comment) => { + console.log(comment); + }); + } } if (lastCommentTimestamp && isMomentRecent(lastCommentTimestamp, threeDayCutoffTime)) { // if commented by assignee within 3 days @@ -179,19 +191,6 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an return { result: true, labels: toUpdateLabel } // outdated, add 'To Update!' label } - let momentIsRecent = isMomentRecent(eventTimestamp, sevenDayCutoffTime); - console.log(momentIsRecent); - if (!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. - console.log("Comment create more than 7 days ago. Hiding as outdated..."); - github.rest.issues.getComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: eventObj.id - }) - .then((comment) => { - console.log(comment); - }); - } // if no comment or assigning found within 14 days, issue is outdated and add '2 weeks inactive' label console.log(`Issue #${issueNum} has no update within 14 days, use '2 weeks inactive' label`) From c9ca8231a3727e752edc034ea82d71128b4d2ccf Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Thu, 7 Mar 2024 20:10:18 -0800 Subject: [PATCH 40/96] Added debug line to make comment printout more distinct --- .../trigger-schedule/add-update-label-weekly/add-label.js | 1 + 1 file changed, 1 insertion(+) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 580d9f7a5b..f4a09462ed 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -158,6 +158,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an comment_id: eventObj.id }) .then((comment) => { + console.log("The comment says this:"); console.log(comment); }); } From 19dd6714676cf07d0fb84fee056bf20930e30247 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Wed, 20 Mar 2024 20:07:12 -0700 Subject: [PATCH 41/96] Now requiring https module --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index f4a09462ed..12e88765b1 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -2,6 +2,7 @@ const findLinkedIssue = require('../../utils/find-linked-issue'); const getTimeline = require('../../utils/get-timeline'); var fs = require("fs"); +const https = require("https"); // Global variables var github; var context; @@ -34,6 +35,7 @@ async function main({ g, c }, columnId) { const issueNums = getIssueNumsFromColumn(columnId); console.log(columnId); console.log(issueNums); + for await (let issueNum of issueNums) { const timeline = await getTimeline(issueNum, github, context); const timelineArray = Array.from(timeline); From c87c02b8fa2e93835c971b5e02c8dad8a2d19018 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Wed, 20 Mar 2024 20:28:02 -0700 Subject: [PATCH 42/96] Commenting out my previous rest request to get comments --- .../add-update-label-weekly/add-label.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 12e88765b1..2061707500 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -154,15 +154,15 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an if (!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. console.log("Comment create more than 7 days ago. Hiding as outdated..."); - github.rest.issues.getComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: eventObj.id - }) - .then((comment) => { - console.log("The comment says this:"); - console.log(comment); - }); + // github.rest.issues.getComment({ + // owner: context.repo.owner, + // repo: context.repo.repo, + // comment_id: eventObj.id + // }) + // .then((comment) => { + // console.log("The comment says this:"); + // console.log(comment); + // }); } } From a5c6f9e9f172bde19a55662215842eab28a0d513 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Sun, 24 Mar 2024 08:21:15 -0700 Subject: [PATCH 43/96] Attempted to retrieve node_id of relevant comments --- .../trigger-schedule/add-update-label-weekly/add-label.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 2061707500..e8497a2442 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -154,6 +154,14 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an if (!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. console.log("Comment create more than 7 days ago. Hiding as outdated..."); + const data = JSON.stringify({ + query: `{ + + }` + }) + + console.log(eventObj.node_id); + // github.rest.issues.getComment({ // owner: context.repo.owner, // repo: context.repo.repo, From 5327c9d1dbee90aa743c477cd30c596605fca3d9 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Sun, 24 Mar 2024 10:35:34 -0700 Subject: [PATCH 44/96] Moving over to node-fetch from https --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index e8497a2442..25cdc5b4da 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -2,7 +2,7 @@ const findLinkedIssue = require('../../utils/find-linked-issue'); const getTimeline = require('../../utils/get-timeline'); var fs = require("fs"); -const https = require("https"); +const fetch = require("node-fetch"); // Global variables var github; var context; From 12c08791b4dc07b10fa30a2bb6eab9484fe84cb0 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Sun, 24 Mar 2024 10:36:24 -0700 Subject: [PATCH 45/96] or not --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 25cdc5b4da..e8497a2442 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -2,7 +2,7 @@ const findLinkedIssue = require('../../utils/find-linked-issue'); const getTimeline = require('../../utils/get-timeline'); var fs = require("fs"); -const fetch = require("node-fetch"); +const https = require("https"); // Global variables var github; var context; From 154dce00362f0f83c124a63a7f3eb80479405a91 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 26 Mar 2024 18:04:48 -0700 Subject: [PATCH 46/96] Let's see if this does it --- .../add-update-label-weekly/add-label.js | 36 +++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index e8497a2442..66a8b05259 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -154,13 +154,37 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an if (!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. console.log("Comment create more than 7 days ago. Hiding as outdated..."); - const data = JSON.stringify({ - query: `{ - - }` - }) + const mutation = JSON.stringify({ + mutation: `{ + mutation HideOutdatedComment($node_id: node_id){ + minimizeComment(input:{ + classifier:OUTDATED + subjectId:"IC_kwDOLAkgZM514ksN" + }) { + clientMutationId + minimizedComment { + isMinimized + minimizedReason + } + } + } + }`, + variables: { + node_id: eventObj.node_id + } + }); + + + const options = { + hostname: 'api.github.com', + path: '/graphql', + method: 'post', + headers: { + 'Content-Type': 'application/json', + 'Authorization': 'bearer ' + context.secrets.GITHUB_TOKEN, // context.secrets.GITHUB_TOKEN? + } + } - console.log(eventObj.node_id); // github.rest.issues.getComment({ // owner: context.repo.owner, From 59a254b1a37b719a44951397bd922a22253ad9ab Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 26 Mar 2024 18:05:02 -0700 Subject: [PATCH 47/96] Added a missing semicolon --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 66a8b05259..12ccc47ceb 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -183,7 +183,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an 'Content-Type': 'application/json', 'Authorization': 'bearer ' + context.secrets.GITHUB_TOKEN, // context.secrets.GITHUB_TOKEN? } - } + }; // github.rest.issues.getComment({ From 62791ad3a9091d41db81f1dac379b97a83d67caf Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 26 Mar 2024 18:13:23 -0700 Subject: [PATCH 48/96] Did I add the PAT correctly? --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 12ccc47ceb..71206ff3b8 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -181,7 +181,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an method: 'post', headers: { 'Content-Type': 'application/json', - 'Authorization': 'bearer ' + context.secrets.GITHUB_TOKEN, // context.secrets.GITHUB_TOKEN? + 'Authorization': 'bearer ' + context.secrets.HFLA_PROJECT_BOARD_TOKEN, // context.secrets.GITHUB_TOKEN? } }; From b6b50c228b5770aeb8f62b57da95be4336528804 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 26 Mar 2024 18:17:21 -0700 Subject: [PATCH 49/96] Now passing PAT as an environment variable --- .github/workflows/schedule-fri-0700.yml | 3 ++- .../trigger-schedule/add-update-label-weekly/add-label.js | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/schedule-fri-0700.yml b/.github/workflows/schedule-fri-0700.yml index c236d40760..5af8f6e48a 100644 --- a/.github/workflows/schedule-fri-0700.yml +++ b/.github/workflows/schedule-fri-0700.yml @@ -13,8 +13,9 @@ jobs: - uses: actions/github-script@v7 env: IN_PROGRESS_COLUMN_ID: ${{ secrets.IN_PROGRESS_COLUMN_ID }} + HFLA_PROJECT_BOARD_TOKEN: ${{ secrets.HFLA_PROJECT_BOARD_TOKEN }} with: script: | const { IN_PROGRESS_COLUMN_ID } = process.env; const script = require('./github-actions/trigger-schedule/add-update-label-weekly/add-label.js'); - script({ g: github, c: context }, IN_PROGRESS_COLUMN_ID); + script({ g: github, c: context }, IN_PROGRESS_COLUMN_ID, HFLA_PROJECT_BOARD_TOKEN); diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 71206ff3b8..e6c3fc13be 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -19,6 +19,8 @@ sevenDayCutoffTime.setDate(sevenDayCutoffTime.getDate() - commentByDays) const fourteenDayCutoffTime = new Date() fourteenDayCutoffTime.setDate(fourteenDayCutoffTime.getDate() - inactiveUpdatedByDays) +var projectBoardToken; + /** * The main function, which retrieves issues from a specific column in a specific project, before examining the timeline of each issue for outdatedness. * An update to an issue is either 1. a comment by the assignee, or 2. assigning an assignee to the issue. If the last update is not within 7 days or 14 days, apply the according outdate label, and request an update. @@ -27,10 +29,12 @@ fourteenDayCutoffTime.setDate(fourteenDayCutoffTime.getDate() - inactiveUpdatedB * @param {Object} g github object from actions/github-script * @param {Object} c context object from actions/github-script * @param {Number} columnId a number presenting a specific column to examine, supplied by GitHub secrets + * @param {String} projectBoardToken the Personal Access Token for the action */ -async function main({ g, c }, columnId) { +async function main({ g, c }, columnId, pbt) { github = g; context = c; + projectBoardToken = pbt; // Retrieve all issue numbers from a column const issueNums = getIssueNumsFromColumn(columnId); console.log(columnId); @@ -181,7 +185,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an method: 'post', headers: { 'Content-Type': 'application/json', - 'Authorization': 'bearer ' + context.secrets.HFLA_PROJECT_BOARD_TOKEN, // context.secrets.GITHUB_TOKEN? + 'Authorization': 'bearer ' + projectBoardToken, // context.secrets.GITHUB_TOKEN? } }; From 7943d8604c23d82f9dd770efea75c3e892ce0714 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 26 Mar 2024 18:21:10 -0700 Subject: [PATCH 50/96] Added yet even more logic to pass the PAT --- .github/workflows/schedule-fri-0700.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/schedule-fri-0700.yml b/.github/workflows/schedule-fri-0700.yml index 5af8f6e48a..f8fdb88257 100644 --- a/.github/workflows/schedule-fri-0700.yml +++ b/.github/workflows/schedule-fri-0700.yml @@ -16,6 +16,7 @@ jobs: HFLA_PROJECT_BOARD_TOKEN: ${{ secrets.HFLA_PROJECT_BOARD_TOKEN }} with: script: | - const { IN_PROGRESS_COLUMN_ID } = process.env; + const IN_PROGRESS_COLUMN_ID = process.env.IN_PROGRESS_COLUMN_ID; + const HFLA_PROJECT_BOARD_TOKEN = process.env.HFLA_PROJECT_BOARD_TOKEN; const script = require('./github-actions/trigger-schedule/add-update-label-weekly/add-label.js'); script({ g: github, c: context }, IN_PROGRESS_COLUMN_ID, HFLA_PROJECT_BOARD_TOKEN); From 5064cd4199b36a43aefa298734f5b84c6ef27271 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 26 Mar 2024 18:25:46 -0700 Subject: [PATCH 51/96] Added code to make https request to graphql API --- .../add-update-label-weekly/add-label.js | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index e6c3fc13be..03ac9c515d 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -189,6 +189,26 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } }; + // copied from https://developer.ibm.com/articles/awb-consuming-graphql-apis-from-plain-javascript/ + const req = https.request(options, (res) => { + let data = ''; + console.log(`statusCode: ${res}`); + + res.on('data', (d) => { + data += d; + }); + res.on('end', () => { + console.log(data); + }); + }); + + req.on('error', (error) => { + console.error(error); + }); + + req.write(data); + req.end(); + // github.rest.issues.getComment({ // owner: context.repo.owner, From 6d78152ecdb72aa21be8662d9ca9c3f430c6e7dc Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 26 Mar 2024 18:26:57 -0700 Subject: [PATCH 52/96] Passed the wrong variable name to the https request --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 03ac9c515d..8c8bb47715 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -206,7 +206,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an console.error(error); }); - req.write(data); + req.write(mutation); req.end(); From ddacc019a0d8425ea0260bb0fde6cabe1c8e1364 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 26 Mar 2024 18:30:47 -0700 Subject: [PATCH 53/96] Added user-agent to headers --- .../trigger-schedule/add-update-label-weekly/add-label.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 8c8bb47715..3805332cda 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -185,7 +185,8 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an method: 'post', headers: { 'Content-Type': 'application/json', - 'Authorization': 'bearer ' + projectBoardToken, // context.secrets.GITHUB_TOKEN? + 'Authorization': 'bearer ' + projectBoardToken, + 'user-agent': 'Add-Update-Label-to-Issues-Weekly' } }; From a7c4ccdfed94ca5dcc656319764d80c09ca72970 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 26 Mar 2024 18:37:19 -0700 Subject: [PATCH 54/96] Did the attribute need to be literally named 'query'? --- .../trigger-schedule/add-update-label-weekly/add-label.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 3805332cda..a6602dbc44 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -159,11 +159,11 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an if (!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. console.log("Comment create more than 7 days ago. Hiding as outdated..."); const mutation = JSON.stringify({ - mutation: `{ + query: `{ mutation HideOutdatedComment($node_id: node_id){ minimizeComment(input:{ classifier:OUTDATED - subjectId:"IC_kwDOLAkgZM514ksN" + subjectId: $node_id }) { clientMutationId minimizedComment { From 1ae55089af8e8d40d7ea2740a7556a486a74ae06 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 26 Mar 2024 18:41:41 -0700 Subject: [PATCH 55/96] Is the query variable written correctly now? --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index a6602dbc44..6af84bbe6b 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -160,7 +160,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an console.log("Comment create more than 7 days ago. Hiding as outdated..."); const mutation = JSON.stringify({ query: `{ - mutation HideOutdatedComment($node_id: node_id){ + mutation HideOutdatedComment($node_id: STRING!){ minimizeComment(input:{ classifier:OUTDATED subjectId: $node_id From dc4e4ac743593f3d32c4c998b1eb44d1a325dfe6 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 26 Mar 2024 18:44:46 -0700 Subject: [PATCH 56/96] Does removing the underscore in nodeid help? --- .../trigger-schedule/add-update-label-weekly/add-label.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 6af84bbe6b..cded7453d4 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -160,7 +160,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an console.log("Comment create more than 7 days ago. Hiding as outdated..."); const mutation = JSON.stringify({ query: `{ - mutation HideOutdatedComment($node_id: STRING!){ + mutation HideOutdatedComment($nodeid: STRING!){ minimizeComment(input:{ classifier:OUTDATED subjectId: $node_id @@ -174,7 +174,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } }`, variables: { - node_id: eventObj.node_id + nodeid: eventObj.node_id } }); From ba7da02f4cdd384f6ff2f51c28304683769edc26 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 26 Mar 2024 18:46:52 -0700 Subject: [PATCH 57/96] Was the query missing a comma? --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index cded7453d4..47c18512e9 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -162,7 +162,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an query: `{ mutation HideOutdatedComment($nodeid: STRING!){ minimizeComment(input:{ - classifier:OUTDATED + classifier:OUTDATED, subjectId: $node_id }) { clientMutationId From 73c08acb0e09bbee843733f0941a2abfe93a59a3 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 26 Mar 2024 20:07:40 -0700 Subject: [PATCH 58/96] Does adding extra quotations around the query help? --- .../trigger-schedule/add-update-label-weekly/add-label.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 47c18512e9..dce356845b 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -158,9 +158,10 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an if (!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. console.log("Comment create more than 7 days ago. Hiding as outdated..."); + //todo: play around with quotations. Stringifying is likely causing the issue const mutation = JSON.stringify({ - query: `{ - mutation HideOutdatedComment($nodeid: STRING!){ + query: `"{ + mutation HideOutdatedComment($nodeid: STRING!){ minimizeComment(input:{ classifier:OUTDATED, subjectId: $node_id @@ -172,7 +173,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } } } - }`, + }"`, variables: { nodeid: eventObj.node_id } From 90b2b852a382956e7acbd7006face9535bef0d19 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 26 Mar 2024 20:12:08 -0700 Subject: [PATCH 59/96] Does getting rid of the outer brackets help? --- .../trigger-schedule/add-update-label-weekly/add-label.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index dce356845b..0af84e8d25 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -160,8 +160,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an console.log("Comment create more than 7 days ago. Hiding as outdated..."); //todo: play around with quotations. Stringifying is likely causing the issue const mutation = JSON.stringify({ - query: `"{ - mutation HideOutdatedComment($nodeid: STRING!){ + query: `mutation HideOutdatedComment($nodeid: STRING!){ minimizeComment(input:{ classifier:OUTDATED, subjectId: $node_id @@ -172,8 +171,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an minimizedReason } } - } - }"`, + }`, variables: { nodeid: eventObj.node_id } From b8f406510abd6fb72f92b2decb045fa973502e9a Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 26 Mar 2024 20:13:42 -0700 Subject: [PATCH 60/96] Changed the casing of "String" in the query --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 0af84e8d25..362b44f9de 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -160,7 +160,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an console.log("Comment create more than 7 days ago. Hiding as outdated..."); //todo: play around with quotations. Stringifying is likely causing the issue const mutation = JSON.stringify({ - query: `mutation HideOutdatedComment($nodeid: STRING!){ + query: `mutation HideOutdatedComment($nodeid: String!){ minimizeComment(input:{ classifier:OUTDATED, subjectId: $node_id From c59907db21fb6b0f9b33f8e9fc8be9f618eafbd3 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 26 Mar 2024 20:14:47 -0700 Subject: [PATCH 61/96] Fixed typo in one instance of "$nodeid" in the query --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 362b44f9de..12627b791a 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -163,7 +163,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an query: `mutation HideOutdatedComment($nodeid: String!){ minimizeComment(input:{ classifier:OUTDATED, - subjectId: $node_id + subjectId: $nodeid }) { clientMutationId minimizedComment { From 91cfd1604617e7d7e82eebc2709a940db5c65c99 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 26 Mar 2024 20:16:16 -0700 Subject: [PATCH 62/96] Changed declared variable type in query from "String!" to "ID!" --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 12627b791a..61b7255218 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -160,7 +160,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an console.log("Comment create more than 7 days ago. Hiding as outdated..."); //todo: play around with quotations. Stringifying is likely causing the issue const mutation = JSON.stringify({ - query: `mutation HideOutdatedComment($nodeid: String!){ + query: `mutation HideOutdatedComment($nodeid: ID!){ minimizeComment(input:{ classifier:OUTDATED, subjectId: $nodeid From aeb2c1f34c88549ee0effb24c8c2eecdea86384b Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Fri, 29 Mar 2024 18:16:10 -0700 Subject: [PATCH 63/96] Removed debug console.logs added by myself and date testing adjustment --- .../add-update-label-weekly/add-label.js | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 61b7255218..0e0048205c 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -37,8 +37,6 @@ async function main({ g, c }, columnId, pbt) { projectBoardToken = pbt; // Retrieve all issue numbers from a column const issueNums = getIssueNumsFromColumn(columnId); - console.log(columnId); - console.log(issueNums); for await (let issueNum of issueNums) { const timeline = await getTimeline(issueNum, github, context); @@ -49,7 +47,6 @@ async function main({ g, c }, columnId, pbt) { console.log(`Assignee not found, skipping issue #${issueNum}`) continue } - console.log("we getting here?"); // Add and remove labels as well as post comment if the issue's timeline indicates the issue is inactive, to be updated or up to date accordingly const responseObject = await isTimelineOutdated(timeline, issueNum, assignees) @@ -140,11 +137,6 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } let eventTimestamp = eventObj.updated_at || eventObj.created_at; - let eventTimestampDate = new Date(eventTimestamp); - eventTimestampDate.setDate(eventTimestampDate.getDate() - 8); // pretend timestamps are 8 days before they really are for testing purposes - eventTimestamp = eventTimestampDate.toString(); - let formattedEventTimestamp = new Date(eventTimestamp).toString(); - console.log("Formatted eventTimestamp: " + formattedEventTimestamp); // update the lastCommentTimestamp if this is the last (most recent) comment by an assignee if (!lastCommentTimestamp && eventType === 'commented' && isCommentByAssignees(eventObj, assignees)) { @@ -157,8 +149,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } if (!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. - console.log("Comment create more than 7 days ago. Hiding as outdated..."); - //todo: play around with quotations. Stringifying is likely causing the issue + console.log("Comment created more than 7 days ago. Hiding as outdated..."); const mutation = JSON.stringify({ query: `mutation HideOutdatedComment($nodeid: ID!){ minimizeComment(input:{ @@ -177,7 +168,6 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } }); - const options = { hostname: 'api.github.com', path: '/graphql', @@ -208,17 +198,6 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an req.write(mutation); req.end(); - - - // github.rest.issues.getComment({ - // owner: context.repo.owner, - // repo: context.repo.repo, - // comment_id: eventObj.id - // }) - // .then((comment) => { - // console.log("The comment says this:"); - // console.log(comment); - // }); } } From 1d940524b49bbac15f54650645b04511f2364d99 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Fri, 29 Mar 2024 18:35:00 -0700 Subject: [PATCH 64/96] Added a new debug log to investigate why comments aren't being hidden anymore --- .../trigger-schedule/add-update-label-weekly/add-label.js | 1 + 1 file changed, 1 insertion(+) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 0e0048205c..41f1aac864 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -148,6 +148,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an lastAssignedTimestamp = eventTimestamp; } + console.log(isMomentRecent(eventTimestamp, sevenDayCutoffTime)); if (!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. console.log("Comment created more than 7 days ago. Hiding as outdated..."); const mutation = JSON.stringify({ From dab07b4cfbd9fb2cebc9f3558156d56c1736acd0 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Fri, 29 Mar 2024 18:36:34 -0700 Subject: [PATCH 65/96] Updated new debug log to include if comment is by bot --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 41f1aac864..347ca9bace 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -148,7 +148,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an lastAssignedTimestamp = eventTimestamp; } - console.log(isMomentRecent(eventTimestamp, sevenDayCutoffTime)); + console.log(!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && isCommentByBot(eventObj)); if (!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. console.log("Comment created more than 7 days ago. Hiding as outdated..."); const mutation = JSON.stringify({ From 397faa55e004639b33ad7c30d0105474df348516 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Fri, 29 Mar 2024 18:37:52 -0700 Subject: [PATCH 66/96] Added eventType to new debug log --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 347ca9bace..ebef010491 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -148,7 +148,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an lastAssignedTimestamp = eventTimestamp; } - console.log(!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && isCommentByBot(eventObj)); + console.log(!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)); if (!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. console.log("Comment created more than 7 days ago. Hiding as outdated..."); const mutation = JSON.stringify({ From 24a3bf662f326ff326c01152b28037ed1ae88cc8 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Fri, 29 Mar 2024 18:39:18 -0700 Subject: [PATCH 67/96] Now looking specifically at eventType --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index ebef010491..15d88957c0 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -148,7 +148,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an lastAssignedTimestamp = eventTimestamp; } - console.log(!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)); + console.log(eventType); if (!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. console.log("Comment created more than 7 days ago. Hiding as outdated..."); const mutation = JSON.stringify({ From baac5c080e77302f8ad1250d759ab7cd4874f642 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Fri, 29 Mar 2024 18:41:15 -0700 Subject: [PATCH 68/96] Determining if bot comments that were unhidden are regarded as not by the bot --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 15d88957c0..b11fd33bf4 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -148,7 +148,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an lastAssignedTimestamp = eventTimestamp; } - console.log(eventType); + console.log(eventType === 'commented' && isCommentByBot(eventObj)); if (!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. console.log("Comment created more than 7 days ago. Hiding as outdated..."); const mutation = JSON.stringify({ From a6893bb4f75698084c1458a225d77d2ca8779fe6 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Fri, 29 Mar 2024 18:43:02 -0700 Subject: [PATCH 69/96] Determining if unhidden bot comments are regarded as recent --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index b11fd33bf4..347ca9bace 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -148,7 +148,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an lastAssignedTimestamp = eventTimestamp; } - console.log(eventType === 'commented' && isCommentByBot(eventObj)); + console.log(!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && isCommentByBot(eventObj)); if (!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. console.log("Comment created more than 7 days ago. Hiding as outdated..."); const mutation = JSON.stringify({ From 8913208884e3dad9f82c761f59fdb781a3fbd982 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Fri, 29 Mar 2024 18:44:42 -0700 Subject: [PATCH 70/96] Welp --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 347ca9bace..f479c57713 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -148,7 +148,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an lastAssignedTimestamp = eventTimestamp; } - console.log(!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && isCommentByBot(eventObj)); + console.log(!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && isCommentByBot(eventObj) && eventType === 'commented'); if (!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. console.log("Comment created more than 7 days ago. Hiding as outdated..."); const mutation = JSON.stringify({ From 22a40681c432c7e0b6444761deaf83b668882005 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Fri, 29 Mar 2024 18:50:28 -0700 Subject: [PATCH 71/96] Switching from using `eventTimestamp` to `eventObj.created_at` --- .../trigger-schedule/add-update-label-weekly/add-label.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index f479c57713..75a41cedde 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -148,8 +148,8 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an lastAssignedTimestamp = eventTimestamp; } - console.log(!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && isCommentByBot(eventObj) && eventType === 'commented'); - if (!isMomentRecent(eventTimestamp, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. + console.log(!isMomentRecent(eventObj.created_at, sevenDayCutoffTime) && isCommentByBot(eventObj) && eventType === 'commented'); + if (!isMomentRecent(eventObj.created_at, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. console.log("Comment created more than 7 days ago. Hiding as outdated..."); const mutation = JSON.stringify({ query: `mutation HideOutdatedComment($nodeid: ID!){ From 731a915395c9ede9e61d4499e8fa5027d84f0e3d Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Fri, 29 Mar 2024 18:54:13 -0700 Subject: [PATCH 72/96] Removed debug log, no longer needed. --- .../trigger-schedule/add-update-label-weekly/add-label.js | 1 - 1 file changed, 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 75a41cedde..6d3d89527c 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -148,7 +148,6 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an lastAssignedTimestamp = eventTimestamp; } - console.log(!isMomentRecent(eventObj.created_at, sevenDayCutoffTime) && isCommentByBot(eventObj) && eventType === 'commented'); if (!isMomentRecent(eventObj.created_at, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. console.log("Comment created more than 7 days ago. Hiding as outdated..."); const mutation = JSON.stringify({ From 16ab1079d85720d448218151cd9334e29bed7962 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Wed, 3 Apr 2024 21:24:42 -0700 Subject: [PATCH 73/96] Reverted `secrets.HFLA_PROJECT_BOARD_TOKEN` name back to `secrets.HACK_FOR_LA_BOT` for usage in canonical website repo --- .github/workflows/schedule-fri-0700.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/schedule-fri-0700.yml b/.github/workflows/schedule-fri-0700.yml index f8fdb88257..4a4aad3961 100644 --- a/.github/workflows/schedule-fri-0700.yml +++ b/.github/workflows/schedule-fri-0700.yml @@ -13,10 +13,10 @@ jobs: - uses: actions/github-script@v7 env: IN_PROGRESS_COLUMN_ID: ${{ secrets.IN_PROGRESS_COLUMN_ID }} - HFLA_PROJECT_BOARD_TOKEN: ${{ secrets.HFLA_PROJECT_BOARD_TOKEN }} + HACK_FOR_LA_BOT: ${{ secrets.HACK_FOR_LA_BOT }} with: script: | const IN_PROGRESS_COLUMN_ID = process.env.IN_PROGRESS_COLUMN_ID; - const HFLA_PROJECT_BOARD_TOKEN = process.env.HFLA_PROJECT_BOARD_TOKEN; + const HACK_FOR_LA_BOT = process.env.HACK_FOR_LA_BOT; const script = require('./github-actions/trigger-schedule/add-update-label-weekly/add-label.js'); - script({ g: github, c: context }, IN_PROGRESS_COLUMN_ID, HFLA_PROJECT_BOARD_TOKEN); + script({ g: github, c: context }, IN_PROGRESS_COLUMN_ID, HACK_FOR_LA_BOT); From 2173c2cc1862a07737cfdc8c03e049c723111b6e Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 9 Apr 2024 14:54:33 -0500 Subject: [PATCH 74/96] Replaced `HACK_FOR_LA_BOT` with `HACKFORLA_BOT_PA_TOKEN` --- .github/workflows/schedule-fri-0700.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/schedule-fri-0700.yml b/.github/workflows/schedule-fri-0700.yml index 4a4aad3961..ada518cd50 100644 --- a/.github/workflows/schedule-fri-0700.yml +++ b/.github/workflows/schedule-fri-0700.yml @@ -13,10 +13,10 @@ jobs: - uses: actions/github-script@v7 env: IN_PROGRESS_COLUMN_ID: ${{ secrets.IN_PROGRESS_COLUMN_ID }} - HACK_FOR_LA_BOT: ${{ secrets.HACK_FOR_LA_BOT }} + HACKFORLA_BOT_PA_TOKEN: ${{ secrets.HACKFORLA_BOT_PA_TOKEN }} with: script: | const IN_PROGRESS_COLUMN_ID = process.env.IN_PROGRESS_COLUMN_ID; - const HACK_FOR_LA_BOT = process.env.HACK_FOR_LA_BOT; + const HACKFORLA_BOT_PA_TOKEN = process.env.HACKFORLA_BOT_PA_TOKEN; const script = require('./github-actions/trigger-schedule/add-update-label-weekly/add-label.js'); - script({ g: github, c: context }, IN_PROGRESS_COLUMN_ID, HACK_FOR_LA_BOT); + script({ g: github, c: context }, IN_PROGRESS_COLUMN_ID, HACKFORLA_BOT_PA_TOKEN); From 4f49ad05218df4a9695d9e2a605a62a9409a52d4 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Sat, 27 Apr 2024 20:45:00 -0700 Subject: [PATCH 75/96] Revert "Replaced `HACK_FOR_LA_BOT` with `HACKFORLA_BOT_PA_TOKEN`" This reverts commit 2173c2cc1862a07737cfdc8c03e049c723111b6e. --- .github/workflows/schedule-fri-0700.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/schedule-fri-0700.yml b/.github/workflows/schedule-fri-0700.yml index ada518cd50..4a4aad3961 100644 --- a/.github/workflows/schedule-fri-0700.yml +++ b/.github/workflows/schedule-fri-0700.yml @@ -13,10 +13,10 @@ jobs: - uses: actions/github-script@v7 env: IN_PROGRESS_COLUMN_ID: ${{ secrets.IN_PROGRESS_COLUMN_ID }} - HACKFORLA_BOT_PA_TOKEN: ${{ secrets.HACKFORLA_BOT_PA_TOKEN }} + HACK_FOR_LA_BOT: ${{ secrets.HACK_FOR_LA_BOT }} with: script: | const IN_PROGRESS_COLUMN_ID = process.env.IN_PROGRESS_COLUMN_ID; - const HACKFORLA_BOT_PA_TOKEN = process.env.HACKFORLA_BOT_PA_TOKEN; + const HACK_FOR_LA_BOT = process.env.HACK_FOR_LA_BOT; const script = require('./github-actions/trigger-schedule/add-update-label-weekly/add-label.js'); - script({ g: github, c: context }, IN_PROGRESS_COLUMN_ID, HACKFORLA_BOT_PA_TOKEN); + script({ g: github, c: context }, IN_PROGRESS_COLUMN_ID, HACK_FOR_LA_BOT); From 4b2c13463624a1d63b3c6ded162c8adde90fa0fe Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Sun, 28 Apr 2024 13:44:19 -0700 Subject: [PATCH 76/96] Revert "Reverted `secrets.HFLA_PROJECT_BOARD_TOKEN` name back to `secrets.HACK_FOR_LA_BOT` for usage in canonical website repo" This reverts commit 16ab1079d85720d448218151cd9334e29bed7962. --- .github/workflows/schedule-fri-0700.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/schedule-fri-0700.yml b/.github/workflows/schedule-fri-0700.yml index 4a4aad3961..f8fdb88257 100644 --- a/.github/workflows/schedule-fri-0700.yml +++ b/.github/workflows/schedule-fri-0700.yml @@ -13,10 +13,10 @@ jobs: - uses: actions/github-script@v7 env: IN_PROGRESS_COLUMN_ID: ${{ secrets.IN_PROGRESS_COLUMN_ID }} - HACK_FOR_LA_BOT: ${{ secrets.HACK_FOR_LA_BOT }} + HFLA_PROJECT_BOARD_TOKEN: ${{ secrets.HFLA_PROJECT_BOARD_TOKEN }} with: script: | const IN_PROGRESS_COLUMN_ID = process.env.IN_PROGRESS_COLUMN_ID; - const HACK_FOR_LA_BOT = process.env.HACK_FOR_LA_BOT; + const HFLA_PROJECT_BOARD_TOKEN = process.env.HFLA_PROJECT_BOARD_TOKEN; const script = require('./github-actions/trigger-schedule/add-update-label-weekly/add-label.js'); - script({ g: github, c: context }, IN_PROGRESS_COLUMN_ID, HACK_FOR_LA_BOT); + script({ g: github, c: context }, IN_PROGRESS_COLUMN_ID, HFLA_PROJECT_BOARD_TOKEN); From 534f35623ffaec19341be09e5856dfaadf481db4 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Sun, 28 Apr 2024 14:19:44 -0700 Subject: [PATCH 77/96] Edited comment minimization code to include timeout between GraphQL requests --- .../add-update-label-weekly/add-label.js | 81 +++++++++---------- 1 file changed, 37 insertions(+), 44 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 6d3d89527c..fe22758d4b 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -115,6 +115,7 @@ async function* getIssueNumsFromColumn(columnId) { function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an arrays of `login`'s let lastAssignedTimestamp = null; let lastCommentTimestamp = null; + let outdatedCommentCount = 0; for (let i = timeline.length - 1; i >= 0; i--) { let eventObj = timeline[i]; @@ -149,55 +150,47 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } if (!isMomentRecent(eventObj.created_at, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. - console.log("Comment created more than 7 days ago. Hiding as outdated..."); - const mutation = JSON.stringify({ - query: `mutation HideOutdatedComment($nodeid: ID!){ - minimizeComment(input:{ - classifier:OUTDATED, - subjectId: $nodeid - }) { - clientMutationId - minimizedComment { - isMinimized - minimizedReason + + // set a timeout to avoid rate limit issues + setTimeout(() => { + console.log(`Comment ${eventObj.node_id} created more than 7 days ago. Hiding as outdated...`); + const mutation = JSON.stringify({ + query: `mutation HideOutdatedComment($nodeid: ID!){ + minimizeComment(input:{ + classifier:OUTDATED, + subjectId: $nodeid + }) { + clientMutationId + minimizedComment { + isMinimized + minimizedReason + } } - } - }`, - variables: { - nodeid: eventObj.node_id - } - }); + }`, + variables: { + nodeid: eventObj.node_id + } + }); - const options = { - hostname: 'api.github.com', - path: '/graphql', - method: 'post', - headers: { - 'Content-Type': 'application/json', - 'Authorization': 'bearer ' + projectBoardToken, - 'user-agent': 'Add-Update-Label-to-Issues-Weekly' - } - }; + const options = { + hostname: 'api.github.com', + path: '/graphql', + method: 'post', + headers: { + 'Content-Type': 'application/json', + 'Authorization': 'bearer ' + projectBoardToken, + 'user-agent': 'Add-Update-Label-to-Issues-Weekly' + } + }; - // copied from https://developer.ibm.com/articles/awb-consuming-graphql-apis-from-plain-javascript/ - const req = https.request(options, (res) => { - let data = ''; - console.log(`statusCode: ${res}`); - - res.on('data', (d) => { - data += d; - }); - res.on('end', () => { - console.log(data); + req.on('error', (error) => { + console.error(error); }); - }); - req.on('error', (error) => { - console.error(error); - }); - - req.write(mutation); - req.end(); + req.write(mutation); + req.end(); + + }, 1000 * outdatedCommentCount++); // set a different timeout length for each outdated comment, each 1000ms (1s) apart. } } From 3ba24e29b50e0d956735089000890b56536fc003 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Sun, 28 Apr 2024 14:22:54 -0700 Subject: [PATCH 78/96] Added missing definition for `req` --- .github/workflows/ga-hide-old-comments-1976.code-workspace | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .github/workflows/ga-hide-old-comments-1976.code-workspace diff --git a/.github/workflows/ga-hide-old-comments-1976.code-workspace b/.github/workflows/ga-hide-old-comments-1976.code-workspace new file mode 100644 index 0000000000..0844037442 --- /dev/null +++ b/.github/workflows/ga-hide-old-comments-1976.code-workspace @@ -0,0 +1,7 @@ +{ + "folders": [ + { + "path": "../.." + } + ] +} \ No newline at end of file From 8ae3a68c4e89cc670cb924c7c1fd4ae43904894b Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Sun, 28 Apr 2024 14:29:31 -0700 Subject: [PATCH 79/96] Now added missing definition for `req` --- .../add-update-label-weekly/add-label.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index fe22758d4b..b0227477c3 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -183,6 +183,19 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } }; + // copied from https://developer.ibm.com/articles/awb-consuming-graphql-apis-from-plain-javascript/ + const req = https.request(options, (res) => { + let data = ''; + console.log(`statusCode: ${res}`); + + res.on('data', (d) => { + data += d; + }); + res.on('end', () => { + console.log(data); + }); + }); + req.on('error', (error) => { console.error(error); }); From 4a3aecb7ef9f9f68fd04649ffb6ca9d27f1d8ce7 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Sun, 28 Apr 2024 14:32:04 -0700 Subject: [PATCH 80/96] Increased base timeout length to 1.5s (from 1s) --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index b0227477c3..9a835753a3 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -203,7 +203,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an req.write(mutation); req.end(); - }, 1000 * outdatedCommentCount++); // set a different timeout length for each outdated comment, each 1000ms (1s) apart. + }, 1500 * outdatedCommentCount++); // set a different timeout length for each outdated comment, each 1000ms (1s) apart. } } From 710041cb51936462ae4f328a5cc1387a2afb0343 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 30 Apr 2024 18:58:46 -0700 Subject: [PATCH 81/96] Removed `setTimeout` and moved GraphQL code to its own function. --- .../add-update-label-weekly/add-label.js | 106 +++++++++--------- 1 file changed, 52 insertions(+), 54 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 9a835753a3..e085faf8b8 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -150,60 +150,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } if (!isMomentRecent(eventObj.created_at, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. - - // set a timeout to avoid rate limit issues - setTimeout(() => { - console.log(`Comment ${eventObj.node_id} created more than 7 days ago. Hiding as outdated...`); - const mutation = JSON.stringify({ - query: `mutation HideOutdatedComment($nodeid: ID!){ - minimizeComment(input:{ - classifier:OUTDATED, - subjectId: $nodeid - }) { - clientMutationId - minimizedComment { - isMinimized - minimizedReason - } - } - }`, - variables: { - nodeid: eventObj.node_id - } - }); - - const options = { - hostname: 'api.github.com', - path: '/graphql', - method: 'post', - headers: { - 'Content-Type': 'application/json', - 'Authorization': 'bearer ' + projectBoardToken, - 'user-agent': 'Add-Update-Label-to-Issues-Weekly' - } - }; - - // copied from https://developer.ibm.com/articles/awb-consuming-graphql-apis-from-plain-javascript/ - const req = https.request(options, (res) => { - let data = ''; - console.log(`statusCode: ${res}`); - - res.on('data', (d) => { - data += d; - }); - res.on('end', () => { - console.log(data); - }); - }); - - req.on('error', (error) => { - console.error(error); - }); - - req.write(mutation); - req.end(); - - }, 1500 * outdatedCommentCount++); // set a different timeout length for each outdated comment, each 1000ms (1s) apart. + minimizeComment(eventObj.node_id); } } @@ -363,4 +310,55 @@ function isCommentByBot(data) { return data.actor.login === botLogin; } +function minimizeComment(node_id) { + const mutation = JSON.stringify({ + query: `mutation HideOutdatedComment($nodeid: ID!){ + minimizeComment(input:{ + classifier:OUTDATED, + subjectId: $nodeid + }) { + clientMutationId + minimizedComment { + isMinimized + minimizedReason + } + } + }`, + variables: { + nodeid: node_id + } + }); + + const options = { + hostname: 'api.github.com', + path: '/graphql', + method: 'post', + headers: { + 'Content-Type': 'application/json', + 'Authorization': 'bearer ' + projectBoardToken, + 'user-agent': 'Add-Update-Label-to-Issues-Weekly' + } + }; + + // copied from https://developer.ibm.com/articles/awb-consuming-graphql-apis-from-plain-javascript/ + const req = https.request(options, (res) => { + let data = ''; + console.log(`statusCode: ${res}`); + + res.on('data', (d) => { + data += d; + }); + res.on('end', () => { + console.log(data); + }); + }); + + req.on('error', (error) => { + console.error(error); + }); + + req.write(mutation); + req.end(); +} + module.exports = main From a87267b9b9abf49b72ee54fed1c3eeb8e89d0e01 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 30 Apr 2024 19:27:20 -0700 Subject: [PATCH 82/96] Added separate async function(s) for handling the minimization of comments, including waiting between GraphQL requests --- .../add-update-label-weekly/add-label.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index e085faf8b8..ff78e7489b 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -116,6 +116,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an let lastAssignedTimestamp = null; let lastCommentTimestamp = null; let outdatedCommentCount = 0; + let commentsToBeMinimized = []; for (let i = timeline.length - 1; i >= 0; i--) { let eventObj = timeline[i]; @@ -150,10 +151,12 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } if (!isMomentRecent(eventObj.created_at, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. - minimizeComment(eventObj.node_id); + commentsToBeMinimized.push(eventObj.node_id); // retain node id so its associated comment can be minimized later } } + minimizeComments(commentsToBeMinimized); + if (lastCommentTimestamp && isMomentRecent(lastCommentTimestamp, threeDayCutoffTime)) { // if commented by assignee within 3 days console.log(`Issue #${issueNum} commented by assignee within 3 days, retain 'Status: Updated' label`); return { result: false, labels: statusUpdatedLabel } // retain (don't add) updated label, remove the other two @@ -310,7 +313,15 @@ function isCommentByBot(data) { return data.actor.login === botLogin; } -function minimizeComment(node_id) { +// asynchronously minimize all the comments that are outdated (> 1 week old) +async function minimizeComments(comment_node_ids) { + for (node_id in comment_node_ids) { + await new Promise((resolve) => { setTimeout(resolve, 1000); }); // wait for 1000ms before doing the GraphQL mutation + await minimizeComment(node_id); + } +} + +async function minimizeComment(node_id) { const mutation = JSON.stringify({ query: `mutation HideOutdatedComment($nodeid: ID!){ minimizeComment(input:{ From 13060c5ddb729026c38a3044e89ae5766070c9a0 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 30 Apr 2024 19:40:21 -0700 Subject: [PATCH 83/96] logging node id for debugging purposes --- .../trigger-schedule/add-update-label-weekly/add-label.js | 1 + 1 file changed, 1 insertion(+) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index ff78e7489b..8968761710 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -152,6 +152,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an if (!isMomentRecent(eventObj.created_at, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. commentsToBeMinimized.push(eventObj.node_id); // retain node id so its associated comment can be minimized later + console.log(eventObj.node_id) // logging node id for debugging purposes } } From 04244c874516be5f2852d9fd6b42ad71b3532449 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 30 Apr 2024 19:42:06 -0700 Subject: [PATCH 84/96] logging node id withing `minimizeComments()` for debugging purposes --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 8968761710..b9a1f55f7d 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -152,7 +152,6 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an if (!isMomentRecent(eventObj.created_at, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. commentsToBeMinimized.push(eventObj.node_id); // retain node id so its associated comment can be minimized later - console.log(eventObj.node_id) // logging node id for debugging purposes } } @@ -317,6 +316,7 @@ function isCommentByBot(data) { // asynchronously minimize all the comments that are outdated (> 1 week old) async function minimizeComments(comment_node_ids) { for (node_id in comment_node_ids) { + console.log(node_id); // log node id for debugging purposes await new Promise((resolve) => { setTimeout(resolve, 1000); }); // wait for 1000ms before doing the GraphQL mutation await minimizeComment(node_id); } From f10452df3c4f9efcdce4f126357e8a503a47b5fc Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 30 Apr 2024 19:44:02 -0700 Subject: [PATCH 85/96] Changed syntax of for-each loop in `minimizeComments` to better comply with conventional JS syntax --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index b9a1f55f7d..1115634515 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -315,7 +315,7 @@ function isCommentByBot(data) { // asynchronously minimize all the comments that are outdated (> 1 week old) async function minimizeComments(comment_node_ids) { - for (node_id in comment_node_ids) { + for (const node_id of comment_node_ids) { console.log(node_id); // log node id for debugging purposes await new Promise((resolve) => { setTimeout(resolve, 1000); }); // wait for 1000ms before doing the GraphQL mutation await minimizeComment(node_id); From 03691c02880eb85c0649e692c1b1a726ca83c3ba Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 30 Apr 2024 19:50:49 -0700 Subject: [PATCH 86/96] Revised console output for minimizing comments --- .../trigger-schedule/add-update-label-weekly/add-label.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 1115634515..454c2d2a4d 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -151,6 +151,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } if (!isMomentRecent(eventObj.created_at, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. + 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 } } @@ -355,13 +356,13 @@ async function minimizeComment(node_id) { // copied from https://developer.ibm.com/articles/awb-consuming-graphql-apis-from-plain-javascript/ const req = https.request(options, (res) => { let data = ''; - console.log(`statusCode: ${res}`); + // console.log(`statusCode: ${res}`); res.on('data', (d) => { data += d; }); res.on('end', () => { - console.log(data); + console.log(`Comment ${node_id} ${data.minimizeComment.minimizedComment.isMinimized ? "is minimized." : "is not minimized."} `); }); }); From 047de96980de1b31336d04510a368c7402973f6f Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 30 Apr 2024 19:53:59 -0700 Subject: [PATCH 87/96] Adjusted attribute syntax for comment minimization logging --- .../trigger-schedule/add-update-label-weekly/add-label.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 454c2d2a4d..fc90cc2b80 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -317,7 +317,6 @@ function isCommentByBot(data) { // asynchronously minimize all the comments that are outdated (> 1 week old) async function minimizeComments(comment_node_ids) { for (const node_id of comment_node_ids) { - console.log(node_id); // log node id for debugging purposes await new Promise((resolve) => { setTimeout(resolve, 1000); }); // wait for 1000ms before doing the GraphQL mutation await minimizeComment(node_id); } @@ -362,7 +361,7 @@ async function minimizeComment(node_id) { data += d; }); res.on('end', () => { - console.log(`Comment ${node_id} ${data.minimizeComment.minimizedComment.isMinimized ? "is minimized." : "is not minimized."} `); + console.log(`Comment ${node_id} ${data.data.minimizeComment.minimizedComment.isMinimized ? "is minimized." : "is not minimized."} `); }); }); From eb98f398219402a02e577d549625f38bea527f23 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 30 Apr 2024 19:56:26 -0700 Subject: [PATCH 88/96] Simplified comment minimization output --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index fc90cc2b80..641b58ab4f 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -361,7 +361,7 @@ async function minimizeComment(node_id) { data += d; }); res.on('end', () => { - console.log(`Comment ${node_id} ${data.data.minimizeComment.minimizedComment.isMinimized ? "is minimized." : "is not minimized."} `); + console.log(f`GraphQL output: ${data}`); }); }); From b22a8d328a769f18e15e81e75be2dd4263f5fcec Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Tue, 30 Apr 2024 19:57:27 -0700 Subject: [PATCH 89/96] Removed pythonic syntax from console output, causing error --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 641b58ab4f..e820eca92d 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -361,7 +361,7 @@ async function minimizeComment(node_id) { data += d; }); res.on('end', () => { - console.log(f`GraphQL output: ${data}`); + console.log(`GraphQL output: ${data}`); }); }); From ba5956e1c7dbdb522624e0256f040f42ff32efbc Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Wed, 1 May 2024 20:29:25 -0700 Subject: [PATCH 90/96] Changed token name for usage in main repo --- .github/workflows/schedule-fri-0700.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/schedule-fri-0700.yml b/.github/workflows/schedule-fri-0700.yml index f8fdb88257..7811586b55 100644 --- a/.github/workflows/schedule-fri-0700.yml +++ b/.github/workflows/schedule-fri-0700.yml @@ -13,10 +13,10 @@ jobs: - uses: actions/github-script@v7 env: IN_PROGRESS_COLUMN_ID: ${{ secrets.IN_PROGRESS_COLUMN_ID }} - HFLA_PROJECT_BOARD_TOKEN: ${{ secrets.HFLA_PROJECT_BOARD_TOKEN }} + HACKFORLA_REPO_TOKEN: ${{ secrets.HACKFORLA_REPO_TOKEN }} with: script: | const IN_PROGRESS_COLUMN_ID = process.env.IN_PROGRESS_COLUMN_ID; - const HFLA_PROJECT_BOARD_TOKEN = process.env.HFLA_PROJECT_BOARD_TOKEN; + const HACKFORLA_REPO_TOKEN = process.env.HACKFORLA_REPO_TOKEN; const script = require('./github-actions/trigger-schedule/add-update-label-weekly/add-label.js'); - script({ g: github, c: context }, IN_PROGRESS_COLUMN_ID, HFLA_PROJECT_BOARD_TOKEN); + script({ g: github, c: context }, IN_PROGRESS_COLUMN_ID, HACKFORLA_REPO_TOKEN); From d28cb7640cc7d586a967b4f4709b487518e8305a Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Mon, 13 May 2024 20:17:51 -0700 Subject: [PATCH 91/96] Changed name of env secret `HACKFORLA_REPO_TOKEN` to `HACKFORLA_ADMIN_TOKEN` --- .github/workflows/schedule-fri-0700.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/schedule-fri-0700.yml b/.github/workflows/schedule-fri-0700.yml index 7811586b55..e6c8c2c68c 100644 --- a/.github/workflows/schedule-fri-0700.yml +++ b/.github/workflows/schedule-fri-0700.yml @@ -13,10 +13,10 @@ jobs: - uses: actions/github-script@v7 env: IN_PROGRESS_COLUMN_ID: ${{ secrets.IN_PROGRESS_COLUMN_ID }} - HACKFORLA_REPO_TOKEN: ${{ secrets.HACKFORLA_REPO_TOKEN }} + HACKFORLA_ADMIN_TOKEN: ${{ secrets.HACKFORLA_ADMIN_TOKEN }} with: script: | const IN_PROGRESS_COLUMN_ID = process.env.IN_PROGRESS_COLUMN_ID; - const HACKFORLA_REPO_TOKEN = process.env.HACKFORLA_REPO_TOKEN; + const HACKFORLA_ADMIN_TOKEN = process.env.HACKFORLA_ADMIN_TOKEN; const script = require('./github-actions/trigger-schedule/add-update-label-weekly/add-label.js'); - script({ g: github, c: context }, IN_PROGRESS_COLUMN_ID, HACKFORLA_REPO_TOKEN); + script({ g: github, c: context }, IN_PROGRESS_COLUMN_ID, HACKFORLA_ADMIN_TOKEN); From b2903e451205629bb8e739310066aff9cd3ee10f Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Thu, 16 May 2024 19:42:56 -0700 Subject: [PATCH 92/96] Removed extra spaces on line 142 of `add-label.js` --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index e820eca92d..f94efe174d 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -139,7 +139,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } let eventTimestamp = eventObj.updated_at || eventObj.created_at; - + // update the lastCommentTimestamp if this is the last (most recent) comment by an assignee if (!lastCommentTimestamp && eventType === 'commented' && isCommentByAssignees(eventObj, assignees)) { lastCommentTimestamp = eventTimestamp; From 79439072d01d966029c6c9985afccccf208f69a3 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Thu, 16 May 2024 19:43:28 -0700 Subject: [PATCH 93/96] Added semicolon to end of line 154 --- .../trigger-schedule/add-update-label-weekly/add-label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index f94efe174d..8297f6217f 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -151,7 +151,7 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an } if (!isMomentRecent(eventObj.created_at, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { // If this event did not happen more recently than 7 days ago AND this event is a comment AND the comment is by GitHub Actions Bot, then hide the comment as outdated. - console.log(`Comment ${eventObj.node_id} is outdated (i.e. > 7 days old) and will be minimized.`) + 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 } } From e5743b7747ec042a5a0e4f02d3e6e61956ea5c0a Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Thu, 16 May 2024 19:45:26 -0700 Subject: [PATCH 94/96] Removed extra line at line 189 of `add-label.js` --- .../trigger-schedule/add-update-label-weekly/add-label.js | 1 - 1 file changed, 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 8297f6217f..370a7b9bf1 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -186,7 +186,6 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an return { result: true, labels: toUpdateLabel } // outdated, add 'To Update!' label } - // if no comment or assigning found within 14 days, issue is outdated and add '2 weeks inactive' label console.log(`Issue #${issueNum} has no update within 14 days, use '2 weeks inactive' label`) return { result: true, labels: inactiveLabel } From d3d85717543a3ae87506b228f5225c73e0eefd5c Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Thu, 16 May 2024 19:46:14 -0700 Subject: [PATCH 95/96] Removed unused variable `outdatedCommentCount` in `isTimelineOutdated()` --- .../trigger-schedule/add-update-label-weekly/add-label.js | 1 - 1 file changed, 1 deletion(-) diff --git a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js index 370a7b9bf1..36120e3493 100644 --- a/github-actions/trigger-schedule/add-update-label-weekly/add-label.js +++ b/github-actions/trigger-schedule/add-update-label-weekly/add-label.js @@ -115,7 +115,6 @@ async function* getIssueNumsFromColumn(columnId) { function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an arrays of `login`'s let lastAssignedTimestamp = null; let lastCommentTimestamp = null; - let outdatedCommentCount = 0; let commentsToBeMinimized = []; for (let i = timeline.length - 1; i >= 0; i--) { From 628a8458b713d94e3f2e16e7bcca23161ae9ad39 Mon Sep 17 00:00:00 2001 From: Ian Cooperman <34320199+iancooperman@users.noreply.github.com> Date: Thu, 16 May 2024 19:48:19 -0700 Subject: [PATCH 96/96] Removed accidentally created file `ga-hide-old-comments-1976.code-workspace` --- .github/workflows/ga-hide-old-comments-1976.code-workspace | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 .github/workflows/ga-hide-old-comments-1976.code-workspace diff --git a/.github/workflows/ga-hide-old-comments-1976.code-workspace b/.github/workflows/ga-hide-old-comments-1976.code-workspace deleted file mode 100644 index 0844037442..0000000000 --- a/.github/workflows/ga-hide-old-comments-1976.code-workspace +++ /dev/null @@ -1,7 +0,0 @@ -{ - "folders": [ - { - "path": "../.." - } - ] -} \ No newline at end of file