From e9b14ff165928a5fa805dec40e3d485447e4d2fb Mon Sep 17 00:00:00 2001 From: Kate Vong Date: Thu, 22 May 2025 22:10:06 -0700 Subject: [PATCH 1/4] Schedule Friday 0700 --- .github/workflows/schedule-fri-0700.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/schedule-fri-0700.yml b/.github/workflows/schedule-fri-0700.yml index f991252395..48eca32dbe 100644 --- a/.github/workflows/schedule-fri-0700.yml +++ b/.github/workflows/schedule-fri-0700.yml @@ -2,6 +2,9 @@ name: Schedule Friday 0700 # This action runs at 7:00 UTC/ 0:00 PDT (midnight) every Friday, except during July and December. on: + push: + branches: + - refactor-minimizeissuecomments-avoid-limit-TEST schedule: - cron: '0 7 * 1-6,8-11 5' workflow_dispatch: @@ -9,7 +12,7 @@ on: jobs: Add-Update-Label-to-Issues-Weekly: runs-on: ubuntu-latest - if: github.repository == 'hackforla/website' + # if: github.repository == 'hackforla/website' steps: - uses: actions/checkout@v4 - uses: actions/github-script@v7 From 55a5780ed0e866b79065643646af2f32047a6e1d Mon Sep 17 00:00:00 2001 From: Kate Vong Date: Thu, 22 May 2025 22:12:54 -0700 Subject: [PATCH 2/4] Schedule Friday 0700 --- .../trigger-schedule/add-update-label-weekly/add-label.js | 8 +++++--- 1 file changed, 5 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 d5139e48b1..8516def9e0 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 @@ -32,12 +32,14 @@ const [ const updatedByDays = 3; // If last update update 3 days, the issue is considered updated const commentByDays = 7; // If last update between 7 to 14 days ago, issue is outdated and needs update const inactiveUpdatedByDays = 14; // If last update greater than 14 days ago, the issue is considered inactive - +const upperLimitDays = 30; // Bot-generated comments older than this are not checked by minimizeComments() const threeDayCutoffTime = new Date(); threeDayCutoffTime.setDate(threeDayCutoffTime.getDate() - updatedByDays); const sevenDayCutoffTime = new Date(); sevenDayCutoffTime.setDate(sevenDayCutoffTime.getDate() - commentByDays); const fourteenDayCutoffTime = new Date(); +const upperLimitCutoffTime = new Date(); +upperLimitCutoffTime.setDate(upperLimitCutoffTime.getDate() - upperLimitDays); fourteenDayCutoffTime.setDate(fourteenDayCutoffTime.getDate() - inactiveUpdatedByDays); @@ -184,8 +186,8 @@ function isTimelineOutdated(timeline, issueNum, assignees) { // assignees is an lastAssignedTimestamp = eventTimestamp; } - // If this event is more than 7 days old AND this event is a comment by the GitHub Actions Bot, then hide the comment as outdated. - if (!isMomentRecent(eventObj.created_at, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { + // If this event is more than 7 days old but less than the upperLimitCutoffTime AND this event is a comment by the GitHub Actions Bot, then hide the comment as outdated. + if (isMomentRecent(eventObj.created_at, upperLimitCutoffTime) && !isMomentRecent(eventObj.created_at, sevenDayCutoffTime) && eventType === 'commented' && isCommentByBot(eventObj)) { console.log(`Comment ${eventObj.node_id} is outdated (i.e. > 7 days old) and will be minimized.`); commentsToBeMinimized.push(eventObj.node_id); // retain node id so its associated comment can be minimized later } From bd254178946ce316f07e433308d71013510a9df9 Mon Sep 17 00:00:00 2001 From: Kate Vong Date: Thu, 22 May 2025 22:24:42 -0700 Subject: [PATCH 3/4] =?UTF-8?q?Limit=20bot=20comment=20hiding=20to=207?= =?UTF-8?q?=E2=80=9330=20day=20window=20to=20reduce=20GraphQL=20calls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/schedule-fri-0700.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/schedule-fri-0700.yml b/.github/workflows/schedule-fri-0700.yml index 48eca32dbe..f991252395 100644 --- a/.github/workflows/schedule-fri-0700.yml +++ b/.github/workflows/schedule-fri-0700.yml @@ -2,9 +2,6 @@ name: Schedule Friday 0700 # This action runs at 7:00 UTC/ 0:00 PDT (midnight) every Friday, except during July and December. on: - push: - branches: - - refactor-minimizeissuecomments-avoid-limit-TEST schedule: - cron: '0 7 * 1-6,8-11 5' workflow_dispatch: @@ -12,7 +9,7 @@ on: jobs: Add-Update-Label-to-Issues-Weekly: runs-on: ubuntu-latest - # if: github.repository == 'hackforla/website' + if: github.repository == 'hackforla/website' steps: - uses: actions/checkout@v4 - uses: actions/github-script@v7 From 4c6053731b83eca5506f76dbebd5639260e81d62 Mon Sep 17 00:00:00 2001 From: Kate Vong Date: Fri, 23 May 2025 16:46:17 -0700 Subject: [PATCH 4/4] Refactor cutoff time logic for consistency and readability --- .../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 8516def9e0..74b33c50cb 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,14 +33,15 @@ const updatedByDays = 3; // If last update update 3 days, the is const commentByDays = 7; // If last update between 7 to 14 days ago, issue is outdated and needs update const inactiveUpdatedByDays = 14; // If last update greater than 14 days ago, the issue is considered inactive const upperLimitDays = 30; // Bot-generated comments older than this are not checked by minimizeComments() + const threeDayCutoffTime = new Date(); threeDayCutoffTime.setDate(threeDayCutoffTime.getDate() - updatedByDays); const sevenDayCutoffTime = new Date(); sevenDayCutoffTime.setDate(sevenDayCutoffTime.getDate() - commentByDays); const fourteenDayCutoffTime = new Date(); -const upperLimitCutoffTime = new Date(); -upperLimitCutoffTime.setDate(upperLimitCutoffTime.getDate() - upperLimitDays); fourteenDayCutoffTime.setDate(fourteenDayCutoffTime.getDate() - inactiveUpdatedByDays); +const upperLimitCutoffTime = new Date(); +upperLimitCutoffTime.setDate(upperLimitCutoffTime.getDate() - upperLimitDays);