#!/usr/bin/env bash # One bounded credential window only; no deploy, model call or orchestration mutation. set -euo pipefail set +x [[ $# == 0 && ${GITHUB_ACTIONS:-${GITEA_ACTIONS:-}} == true && ${BRANCH:-} == ci/v4-stage-acceptance && ${GITHUB_RUN_ATTEMPT:-} == 1 && ${DEPLOY_SHA:-} =~ ^[a-f0-9]{40}$ ]] || exit 2 # Separate workflow source SHA from the immutable, already-deployed Stage artifact. export DEPLOY_SHA=f7055111648906a6a328c973c354c90bd559ef65 export STAGE_TEST_APPROVAL=owner-authorized-stage-editorial export STAGE_TEST_SESSION=v4-ci-acceptance-20261024 export STAGE_TEST_TTL_SECONDS=600 wrapper="$(dirname "${BASH_SOURCE[0]}")/ci-stage-test-principal.sh" close() { rc=$? trap - EXIT HUP INT TERM export STAGE_TEST_ACTION=close if ! bash "$wrapper"; then printf 'Stage close pending: durable 600-second cleanup intent retained\n' >&2 rc=1 fi exit "$rc" } # Install before open: failed/partial open must also attempt generation-fenced close. trap close EXIT trap 'exit 130' INT trap 'exit 143' TERM HUP export STAGE_TEST_ACTION=open bash "$wrapper" printf 'Stage credential window opened; authenticated acceptance NOT performed by this workflow\n' # Keep the reviewed principal available for parent HTTP tests; timer is a hard backstop. sleep 480