From deaffd92eedee6af8f9899a52e13c9044b4ad109 Mon Sep 17 00:00:00 2001 From: Andrea Brancaleoni Date: Mon, 8 Jan 2024 15:08:11 +0100 Subject: [PATCH] dependabot-nudge.yml: minLevel high if not first monday, medium otherwise --- .github/workflows/dependabot-nudge.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/dependabot-nudge.yml b/.github/workflows/dependabot-nudge.yml index c70c96eb..27265b0d 100644 --- a/.github/workflows/dependabot-nudge.yml +++ b/.github/workflows/dependabot-nudge.yml @@ -28,7 +28,18 @@ jobs: const debug = process.env.DEBUG === 'true'; const { default: sendSlackMessage } = await import('${{ github.workspace }}/src/sendSlackMessage.js'); const { default: dependabotNudge } = await import('${{ github.workspace }}/src/dependabotNudge.js'); - const messages = await dependabotNudge({debug, org: process.env.GITHUB_REPOSITORY_OWNER, github: github, minlevel: 'medium'}); + + // set minlevel to 'medium' if it's the first Monday of the month, otherwise stick to high or critical issues + let minlevel = 'medium'; + const today = new Date(); + const firstMonday = new Date(today.getFullYear(), today.getMonth(), 1 + (1 - today.getDay()) % 7); + if (today.getMonth() !== firstMonday.getMonth() || today.getDate() !== firstMonday.getDate()) { + if (debug) + console.log('Not the first Monday of the month!'); + minlevel = 'high'; + } + + const messages = await dependabotNudge({debug, org: process.env.GITHUB_REPOSITORY_OWNER, github: github, minlevel: minlevel}); for (const message of messages) { try {