diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 76bb1301..de52d538 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,8 +6,12 @@ on: - main pull_request: workflow_dispatch: + inputs: + branch: + description: 'Branch to run tests against (leave empty to use the selected branch above)' + type: string schedule: - - cron: '0 */2 * * *' # Every 2 hours; controlled by ENABLE_SCHEDULED_TESTS + SCHEDULED_TESTS_UNTIL vars + - cron: "0 */2 * * *" # Every 2 hours; stop by disabling the workflow or letting SCHEDULED_TESTS_UNTIL expire permissions: contents: read @@ -126,17 +130,12 @@ jobs: enabled: ${{ steps.check.outputs.enabled }} branch: ${{ steps.check.outputs.branch }} steps: - - name: Check ENABLE_SCHEDULED_TESTS and SCHEDULED_TESTS_UNTIL + - name: Check SCHEDULED_TESTS_UNTIL id: check run: | - if [[ "${{ vars.ENABLE_SCHEDULED_TESTS }}" != "true" ]]; then - echo "Scheduled tests disabled (ENABLE_SCHEDULED_TESTS != true)" - echo "enabled=false" >> "$GITHUB_OUTPUT" - exit 0 - fi until_date="${{ vars.SCHEDULED_TESTS_UNTIL }}" if [[ -z "$until_date" ]]; then - echo "No expiry date set (SCHEDULED_TESTS_UNTIL is empty)" + echo "SCHEDULED_TESTS_UNTIL not set — skipping" echo "enabled=false" >> "$GITHUB_OUTPUT" exit 0 fi @@ -145,7 +144,7 @@ jobs: if (( now <= until )); then echo "Schedule active until $until_date" echo "enabled=true" >> "$GITHUB_OUTPUT" - echo "branch=${{ vars.SCHEDULED_TESTS_BRANCH || 'main' }}" >> "$GITHUB_OUTPUT" + echo "branch=main" >> "$GITHUB_OUTPUT" else echo "Schedule window expired on $until_date" echo "enabled=false" >> "$GITHUB_OUTPUT" @@ -165,7 +164,7 @@ jobs: - name: ⬇️ Checkout Repository uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: - ref: ${{ needs.schedule-gate.outputs.branch || github.ref }} + ref: ${{ inputs.branch || needs.schedule-gate.outputs.branch || github.ref }} - name: 📦 Setup pnpm uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 @@ -224,7 +223,7 @@ jobs: - name: ⬇️ Checkout Repository uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: - ref: ${{ needs.schedule-gate.outputs.branch || github.ref }} + ref: ${{ inputs.branch || needs.schedule-gate.outputs.branch || github.ref }} - name: 📦 Setup pnpm uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 @@ -283,7 +282,7 @@ jobs: - name: ⬇️ Checkout Repository uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: - ref: ${{ needs.schedule-gate.outputs.branch || github.ref }} + ref: ${{ inputs.branch || needs.schedule-gate.outputs.branch || github.ref }} - name: 📦 Setup pnpm uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 @@ -342,7 +341,7 @@ jobs: - name: ⬇️ Checkout Repository uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: - ref: ${{ needs.schedule-gate.outputs.branch || github.ref }} + ref: ${{ inputs.branch || needs.schedule-gate.outputs.branch || github.ref }} - name: 📦 Setup pnpm uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0 @@ -401,7 +400,7 @@ jobs: - name: ⬇️ Checkout Repository uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 with: - ref: ${{ needs.schedule-gate.outputs.branch || github.ref }} + ref: ${{ inputs.branch || needs.schedule-gate.outputs.branch || github.ref }} - name: 📦 Setup pnpm uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0