Skip to content

Commit fba50da

Browse files
committed
Gate proof nudges to 5am Central
1 parent 71e4da1 commit fba50da

3 files changed

Lines changed: 29 additions & 1 deletion

File tree

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ on:
3131
default: ""
3232
schedule:
3333
- cron: "0 10 * * *"
34+
- cron: "0 11 * * *"
3435

3536
permissions:
3637
contents: read
@@ -52,13 +53,31 @@ jobs:
5253
runs-on: ubuntu-latest
5354
timeout-minutes: 60
5455
steps:
56+
- name: Check scheduled Central time
57+
id: central-time
58+
if: ${{ github.event_name == 'schedule' }}
59+
env:
60+
PROOF_NUDGES_SCHEDULE_TZ: America/Chicago
61+
run: |
62+
local_hour="$(TZ="$PROOF_NUDGES_SCHEDULE_TZ" date +%H)"
63+
local_time="$(TZ="$PROOF_NUDGES_SCHEDULE_TZ" date '+%Y-%m-%d %H:%M:%S %Z')"
64+
if [ "$local_hour" = "05" ]; then
65+
echo "should_run=true" >> "$GITHUB_OUTPUT"
66+
echo "Scheduled proof nudges running at $local_time."
67+
else
68+
echo "should_run=false" >> "$GITHUB_OUTPUT"
69+
echo "::notice::Skipping scheduled proof nudges at $local_time; waiting for 05:00 America/Chicago."
70+
fi
71+
5572
- uses: actions/checkout@v6
73+
if: ${{ github.event_name != 'schedule' || steps.central-time.outputs.should_run == 'true' }}
5674
with:
5775
filter: blob:none
5876
fetch-depth: 0
5977

6078
- name: Resolve target repository
6179
id: target
80+
if: ${{ github.event_name != 'schedule' || steps.central-time.outputs.should_run == 'true' }}
6281
env:
6382
TARGET_REPO_INPUT: ${{ github.event.inputs.target_repo || vars.CLAWSWEEPER_PROOF_NUDGES_TARGET_REPO || 'openclaw/openclaw' }}
6483
run: |
@@ -77,6 +96,7 @@ jobs:
7796
7897
- name: Create target proof-nudge token
7998
id: target-proof-token
99+
if: ${{ github.event_name != 'schedule' || steps.central-time.outputs.should_run == 'true' }}
80100
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
81101
with:
82102
client-id: ${{ env.CLAWSWEEPER_APP_CLIENT_ID }}
@@ -89,20 +109,24 @@ jobs:
89109

90110
- name: Create state token
91111
id: state-token
112+
if: ${{ github.event_name != 'schedule' || steps.central-time.outputs.should_run == 'true' }}
92113
uses: ./.github/actions/create-state-token
93114
with:
94115
client-id: ${{ env.CLAWSWEEPER_APP_CLIENT_ID }}
95116
private-key: ${{ secrets.CLAWSWEEPER_APP_PRIVATE_KEY }}
96117

97118
- uses: ./.github/actions/setup-state
119+
if: ${{ github.event_name != 'schedule' || steps.central-time.outputs.should_run == 'true' }}
98120
with:
99121
token: ${{ steps.state-token.outputs.token }}
100122

101123
- uses: ./.github/actions/setup-pnpm
124+
if: ${{ github.event_name != 'schedule' || steps.central-time.outputs.should_run == 'true' }}
102125
with:
103126
build-script: build:all
104127

105128
- name: Run proof nudges
129+
if: ${{ github.event_name != 'schedule' || steps.central-time.outputs.should_run == 'true' }}
106130
env:
107131
GH_TOKEN: ${{ steps.target-proof-token.outputs.token }}
108132
TARGET_REPO: ${{ steps.target.outputs.target_repo }}

‎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 a daily scheduled lane at `0 10 * * *`, which is 5:00 AM Central during daylight time, but it is off by default. This lets maintainers enable scheduled proof nudges later without another code change.
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.
6464

6565
Scheduled operation uses repository variables:
6666

‎test/clawsweeper.test.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16085,7 +16085,11 @@ test("proof nudge workflow is manual-first and scheduled behind repo vars", () =
1608516085
assert.doesNotMatch(sweepWorkflow, /proof_nudges/);
1608616086
assert.match(workflow, /execute:[\s\S]*?default: "false"/);
1608716087
assert.match(workflow, /cron: "0 10 \* \* \*"/);
16088+
assert.match(workflow, /cron: "0 11 \* \* \*"/);
1608816089
assert.match(concurrency, /clawsweeper-proof-nudges/);
16090+
assert.match(job, /PROOF_NUDGES_SCHEDULE_TZ: America\/Chicago/);
16091+
assert.match(job, /local_hour=.*date \+%H/);
16092+
assert.match(job, /steps\.central-time\.outputs\.should_run == 'true'/);
1608916093
assert.match(job, /github\.event_name == 'workflow_dispatch'/);
1609016094
assert.match(job, /vars\.CLAWSWEEPER_PROOF_NUDGES_SCHEDULED == '1'/);
1609116095
assert.match(job, /vars\.CLAWSWEEPER_PROOF_NUDGES_EXECUTE == '1'/);

0 commit comments

Comments
 (0)