From 4da3995daecf8d112f736f5a3c95dad3eecb1c22 Mon Sep 17 00:00:00 2001 From: Aman Bansal Date: Fri, 2 Oct 2026 12:41:05 +0530 Subject: [PATCH] Fix glossary reminder guard so the Slack post is skipped on non-Thursdays The "Guard: only run on 4th Thursday" step ended with `exit 0` when the date did not match. That only ends the guard step; the job continues and the "Post message to Slack" step still runs. This is why the reminder was posted on both Thu Jan 22 and Fri Jan 23 2026 (00:15 UTC), after which the workflow was disabled. The cron also listed a weekday (`4`) together with a day-of-month range. cron ORs those two fields when both are restricted, so the schedule fired on every day 22-28 and additionally on every Thursday of the month, which is what put the guard on the critical path in the first place. - Make the guard write `post=true|false` to `$GITHUB_OUTPUT` and gate the Slack step on `steps.guard.outputs.post == 'true'`. Manual `workflow_dispatch` runs keep posting unconditionally, as before. - Drop the weekday from the cron so the schedule only fires on the 22nd-28th of the meeting months; the guard picks the Thursday. - Parse the day of month in base 10 so `08`/`09` are not treated as octal by `[[ ... -lt ... ]]` (which would fail the step under `set -e` on a manual run on those days). The schedule stays in UTC to match the meeting, which is fixed at 00:00 UTC. Fixes #153 Signed-off-by: Aman Bansal --- .../scheduled-slack-glossary-maintainers.yaml | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/scheduled-slack-glossary-maintainers.yaml b/.github/workflows/scheduled-slack-glossary-maintainers.yaml index 164c11502..bccf9ac2d 100644 --- a/.github/workflows/scheduled-slack-glossary-maintainers.yaml +++ b/.github/workflows/scheduled-slack-glossary-maintainers.yaml @@ -3,10 +3,12 @@ name: "Slack scheduled message: CNCF Glossary WG reminder" on: workflow_dispatch: schedule: - # 4th Thursday is always the 22nd–28th, on weekday 4 (Thursday) - # Every 2 months starting January: Jan, Mar, May, Jul, Sep, Nov - # 00:00 UTC - - cron: "0 0 22-28 1,3,5,7,9,11 4" + # The meeting is on the 4th Thursday of every 2nd month (Jan, Mar, May, Jul, + # Sep, Nov) at 00:00 UTC. The 4th Thursday is always the 22nd–28th. + # cron ORs day-of-month and day-of-week when both are restricted, so a + # weekday here would add runs instead of narrowing them; the guard step + # below is what selects the Thursday. + - cron: "0 0 22-28 1,3,5,7,9,11 *" permissions: contents: none @@ -16,16 +18,22 @@ jobs: if: github.repository == 'cncf/automation' runs-on: ubuntu-latest steps: - - name: "Guard: only run on 4th Thursday" + - name: "Guard: only run on 4th Thursday" + id: guard shell: bash run: | day_of_week=$(date -u +%u) # 1=Mon, 4=Thu, 7=Sun - day_of_month=$(date -u +%d) + day_of_month=$((10#$(date -u +%d))) # base 10 so 08/09 are not read as octal if [[ "$day_of_week" != "4" || "$day_of_month" -lt 22 || "$day_of_month" -gt 28 ]]; then - echo "Not the 4th Thursday (day_of_week=$day_of_week, day_of_month=$day_of_month). Exiting." - exit 0 + echo "Not the 4th Thursday (day_of_week=$day_of_week, day_of_month=$day_of_month). Skipping." + echo "post=false" >> "$GITHUB_OUTPUT" + else + echo "post=true" >> "$GITHUB_OUTPUT" fi - name: Post message to Slack + # exit 0 in the guard only ends that step; the job keeps going. Gate on + # the guard's output instead. Manual runs always post. + if: github.event_name == 'workflow_dispatch' || steps.guard.outputs.post == 'true' uses: rtCamp/action-slack-notify@33ca3be66c6f378fe1610fd1d5258632dbed5e58 # v2.4.0 env: SLACK_ICON: https://github.com/cncf.png?size=48