|
13 | 13 | - 'package.json' |
14 | 14 | - 'packages/ai/**' |
15 | 15 | - 'scripts/publish-model-catalog.mjs' |
| 16 | + # GitHub schedules use UTC. Run hourly candidates across the CET/CEST |
| 17 | + # boundaries; the publish job only uploads at 10:17, 12:17, and 14:17 |
| 18 | + # Europe/Vienna time. |
16 | 19 | schedule: |
17 | | - - cron: '17 */4 * * *' |
| 20 | + - cron: '17 8-13 * * 1-5' |
18 | 21 | workflow_dispatch: |
19 | 22 | inputs: |
20 | 23 | source_ref: |
|
36 | 39 | if: ${{ github.event_name != 'workflow_run' || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main') }} |
37 | 40 | runs-on: ubuntu-latest |
38 | 41 | env: |
39 | | - SOURCE_REF: ${{ github.event.workflow_run.head_sha || github.event.pull_request.head.sha || inputs.source_ref || github.sha }} |
| 42 | + SOURCE_REF: ${{ github.event.workflow_run.head_sha || inputs.source_ref || github.sha }} |
40 | 43 | steps: |
41 | 44 | - name: Checkout |
42 | 45 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
@@ -103,7 +106,38 @@ jobs: |
103 | 106 | - name: Verify AWS CLI |
104 | 107 | run: aws --version |
105 | 108 |
|
| 109 | + - name: Check publication window |
| 110 | + id: publication-window |
| 111 | + env: |
| 112 | + EVENT_NAME: ${{ github.event_name }} |
| 113 | + MANUAL_PUBLISH: ${{ inputs.publish || false }} |
| 114 | + run: | |
| 115 | + set -euo pipefail |
| 116 | +
|
| 117 | + local_day="$(TZ=Europe/Vienna date +%u)" |
| 118 | + local_hour_text="$(TZ=Europe/Vienna date +%H)" |
| 119 | + local_hour="$((10#$local_hour_text))" |
| 120 | + local_time="$(TZ=Europe/Vienna date '+%Y-%m-%d %H:%M:%S %Z')" |
| 121 | + allowed=false |
| 122 | + reason="outside the Monday-Friday 10:00-15:00 Europe/Vienna publication window" |
| 123 | +
|
| 124 | + if [[ "$EVENT_NAME" == "workflow_dispatch" && "$MANUAL_PUBLISH" == "true" ]]; then |
| 125 | + allowed=true |
| 126 | + reason="manual publication" |
| 127 | + elif (( local_day <= 5 && local_hour >= 10 && local_hour < 15 )); then |
| 128 | + if [[ "$EVENT_NAME" != "schedule" ]] || (( (local_hour - 10) % 2 == 0 )); then |
| 129 | + allowed=true |
| 130 | + reason="business-hours publication" |
| 131 | + else |
| 132 | + reason="not a scheduled 10:17, 12:17, or 14:17 Europe/Vienna publication" |
| 133 | + fi |
| 134 | + fi |
| 135 | +
|
| 136 | + echo "allowed=$allowed" >> "$GITHUB_OUTPUT" |
| 137 | + echo "R2 publication allowed: $allowed ($reason; local time: $local_time)" |
| 138 | +
|
106 | 139 | - name: Publish model catalog to R2 |
| 140 | + if: steps.publication-window.outputs.allowed == 'true' |
107 | 141 | run: | |
108 | 142 | node scripts/publish-model-catalog.mjs \ |
109 | 143 | --input .artifacts/model-catalog \ |
|
0 commit comments