Skip to content

Commit a734a88

Browse files
committed
Handle delayed proof nudge schedules
1 parent 9c50a95 commit a734a88

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

‎.github/workflows/proof-nudges.yml‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,17 @@ jobs:
5858
if: ${{ github.event_name == 'schedule' }}
5959
env:
6060
PROOF_NUDGES_SCHEDULE_TZ: America/Chicago
61+
PROOF_NUDGES_EVENT_SCHEDULE: ${{ github.event.schedule }}
6162
run: |
62-
local_hour="$(TZ="$PROOF_NUDGES_SCHEDULE_TZ" date +%H)"
6363
local_time="$(TZ="$PROOF_NUDGES_SCHEDULE_TZ" date '+%Y-%m-%d %H:%M:%S %Z')"
64-
if [ "$local_hour" = "05" ]; then
64+
local_zone="$(TZ="$PROOF_NUDGES_SCHEDULE_TZ" date +%Z)"
65+
if { [ "$PROOF_NUDGES_EVENT_SCHEDULE" = "0 10 * * *" ] && [ "$local_zone" = "CDT" ]; } ||
66+
{ [ "$PROOF_NUDGES_EVENT_SCHEDULE" = "0 11 * * *" ] && [ "$local_zone" = "CST" ]; }; then
6567
echo "should_run=true" >> "$GITHUB_OUTPUT"
66-
echo "Scheduled proof nudges running at $local_time."
68+
echo "Scheduled proof nudges running for $PROOF_NUDGES_EVENT_SCHEDULE at $local_time."
6769
else
6870
echo "should_run=false" >> "$GITHUB_OUTPUT"
69-
echo "::notice::Skipping scheduled proof nudges at $local_time; waiting for 05:00 America/Chicago."
71+
echo "::notice::Skipping scheduled proof nudges for $PROOF_NUDGES_EVENT_SCHEDULE at $local_time; waiting for the 5:00 AM America/Chicago cron candidate."
7072
fi
7173
7274
- uses: actions/checkout@v6

‎docs/proof-nudges.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Useful options:
6060

6161
The `ClawSweeper Proof Nudges` workflow exposes this as a manual `workflow_dispatch` lane. It defaults to dry-run. Use `execute=true` only after reviewing a dry-run report.
6262

63-
The workflow also includes daily scheduled lanes at `0 10 * * *` and `0 11 * * *`, but it is off by default. Those UTC schedules are guarded by an `America/Chicago` local-time check so only the 5:00 AM Central run continues across daylight saving time changes.
63+
The workflow also includes daily scheduled lanes at `0 10 * * *` and `0 11 * * *`, but it is off by default. Those UTC schedules are guarded by the scheduled cron string and the current `America/Chicago` timezone abbreviation, so only the 5:00 AM Central candidate continues across daylight saving time changes even if GitHub starts the run late.
6464

6565
Scheduled operation uses repository variables:
6666

‎test/clawsweeper.test.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16088,7 +16088,10 @@ test("proof nudge workflow is manual-first and scheduled behind repo vars", () =
1608816088
assert.match(workflow, /cron: "0 11 \* \* \*"/);
1608916089
assert.match(concurrency, /clawsweeper-proof-nudges/);
1609016090
assert.match(job, /PROOF_NUDGES_SCHEDULE_TZ: America\/Chicago/);
16091-
assert.match(job, /local_hour=.*date \+%H/);
16091+
assert.match(job, /PROOF_NUDGES_EVENT_SCHEDULE: \$\{\{ github\.event\.schedule \}\}/);
16092+
assert.match(job, /local_zone=.*date \+%Z/);
16093+
assert.match(job, /PROOF_NUDGES_EVENT_SCHEDULE" = "0 10 \* \* \*"/);
16094+
assert.match(job, /PROOF_NUDGES_EVENT_SCHEDULE" = "0 11 \* \* \*"/);
1609216095
assert.match(job, /steps\.central-time\.outputs\.should_run == 'true'/);
1609316096
assert.match(job, /github\.event_name == 'workflow_dispatch'/);
1609416097
assert.match(job, /vars\.CLAWSWEEPER_PROOF_NUDGES_SCHEDULED == '1'/);

0 commit comments

Comments
 (0)