#!/usr/bin/env bash
set -eu
# Run from a current origin/main worktree after vp i. Keep the downloaded files together.
bundle=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
cp "$bundle/pr-watch-finishes-after-failure.e2e.ts" scripts/scenarios/pr-watch-finishes-after-failure.e2e.ts
export T3_WATCH_PROOF_DIR
T3_WATCH_PROOF_DIR=$(mktemp -d)
export T3CODE_DEV_SEED=0
export T3_SCENARIO_INHERIT_ENV=NODE_OPTIONS,GH_HOST,GH_ENTERPRISE_TOKEN,T3CODE_DEV_SEED,T3_WATCH_PROOF_DIR
export NODE_OPTIONS="--import=$bundle/github-feed.mjs"
export GH_HOST=github.scenario.invalid
export GH_ENTERPRISE_TOKEN=scenario-only-token
head=83c52f53108a377ac9029ad3405cc0bc9c78d535
base=$(git merge-base origin/main "$head")
vp run scenarios:prove scripts/scenarios/pr-watch-finishes-after-failure.e2e.ts --base "$base" --head "$head" --upload-command 'ghdrop upload'
