Skip to content

Commit 58b17dd

Browse files
chore: fix flow (#1153)
1 parent f7c512a commit 58b17dd

1 file changed

Lines changed: 13 additions & 14 deletions

File tree

.github/workflows/tests.yml

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ on:
66
- main
77
pull_request:
88
workflow_dispatch:
9+
inputs:
10+
branch:
11+
description: 'Branch to run tests against (leave empty to use the selected branch above)'
12+
type: string
913
schedule:
10-
- cron: '0 */2 * * *' # Every 2 hours; controlled by ENABLE_SCHEDULED_TESTS + SCHEDULED_TESTS_UNTIL vars
14+
- cron: "0 */2 * * *" # Every 2 hours; stop by disabling the workflow or letting SCHEDULED_TESTS_UNTIL expire
1115

1216
permissions:
1317
contents: read
@@ -126,17 +130,12 @@ jobs:
126130
enabled: ${{ steps.check.outputs.enabled }}
127131
branch: ${{ steps.check.outputs.branch }}
128132
steps:
129-
- name: Check ENABLE_SCHEDULED_TESTS and SCHEDULED_TESTS_UNTIL
133+
- name: Check SCHEDULED_TESTS_UNTIL
130134
id: check
131135
run: |
132-
if [[ "${{ vars.ENABLE_SCHEDULED_TESTS }}" != "true" ]]; then
133-
echo "Scheduled tests disabled (ENABLE_SCHEDULED_TESTS != true)"
134-
echo "enabled=false" >> "$GITHUB_OUTPUT"
135-
exit 0
136-
fi
137136
until_date="${{ vars.SCHEDULED_TESTS_UNTIL }}"
138137
if [[ -z "$until_date" ]]; then
139-
echo "No expiry date set (SCHEDULED_TESTS_UNTIL is empty)"
138+
echo "SCHEDULED_TESTS_UNTIL not set — skipping"
140139
echo "enabled=false" >> "$GITHUB_OUTPUT"
141140
exit 0
142141
fi
@@ -145,7 +144,7 @@ jobs:
145144
if (( now <= until )); then
146145
echo "Schedule active until $until_date"
147146
echo "enabled=true" >> "$GITHUB_OUTPUT"
148-
echo "branch=${{ vars.SCHEDULED_TESTS_BRANCH || 'main' }}" >> "$GITHUB_OUTPUT"
147+
echo "branch=main" >> "$GITHUB_OUTPUT"
149148
else
150149
echo "Schedule window expired on $until_date"
151150
echo "enabled=false" >> "$GITHUB_OUTPUT"
@@ -165,7 +164,7 @@ jobs:
165164
- name: ⬇️ Checkout Repository
166165
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
167166
with:
168-
ref: ${{ needs.schedule-gate.outputs.branch || github.ref }}
167+
ref: ${{ inputs.branch || needs.schedule-gate.outputs.branch || github.ref }}
169168

170169
- name: 📦 Setup pnpm
171170
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
@@ -224,7 +223,7 @@ jobs:
224223
- name: ⬇️ Checkout Repository
225224
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
226225
with:
227-
ref: ${{ needs.schedule-gate.outputs.branch || github.ref }}
226+
ref: ${{ inputs.branch || needs.schedule-gate.outputs.branch || github.ref }}
228227

229228
- name: 📦 Setup pnpm
230229
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
@@ -283,7 +282,7 @@ jobs:
283282
- name: ⬇️ Checkout Repository
284283
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
285284
with:
286-
ref: ${{ needs.schedule-gate.outputs.branch || github.ref }}
285+
ref: ${{ inputs.branch || needs.schedule-gate.outputs.branch || github.ref }}
287286

288287
- name: 📦 Setup pnpm
289288
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
@@ -342,7 +341,7 @@ jobs:
342341
- name: ⬇️ Checkout Repository
343342
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
344343
with:
345-
ref: ${{ needs.schedule-gate.outputs.branch || github.ref }}
344+
ref: ${{ inputs.branch || needs.schedule-gate.outputs.branch || github.ref }}
346345

347346
- name: 📦 Setup pnpm
348347
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
@@ -401,7 +400,7 @@ jobs:
401400
- name: ⬇️ Checkout Repository
402401
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
403402
with:
404-
ref: ${{ needs.schedule-gate.outputs.branch || github.ref }}
403+
ref: ${{ inputs.branch || needs.schedule-gate.outputs.branch || github.ref }}
405404

406405
- name: 📦 Setup pnpm
407406
uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0

0 commit comments

Comments
 (0)