#!/bin/sh
set -eu
# Load the provided Azure test environment before running this from the scenario checkout.
: "${AZURE_DEVOPS_TEST_ORG:?}" "${AZURE_DEVOPS_TEST_PROJECT:?}" "${AZURE_DEVOPS_EXT_PAT:?}"
item=$(az boards work-item create --organization "$AZURE_DEVOPS_TEST_ORG" --project "$AZURE_DEVOPS_TEST_PROJECT" --type Task --title 'Azure issue viewer proof 38069 round 2' --query id -o tsv)
trap 'az boards work-item delete --id "$item" --organization "$AZURE_DEVOPS_TEST_ORG" --project "$AZURE_DEVOPS_TEST_PROJECT" --yes >/dev/null' EXIT
az boards work-item show --id "$item" --organization "$AZURE_DEVOPS_TEST_ORG" --query id -o tsv
# This is expected to fail with: --area is not present in current organization
az devops invoke --area profile --resource profiles --route-parameters id=me --organization "$AZURE_DEVOPS_TEST_ORG" -o json || true
T3CODE_DEV_SEED=0 T3_SCENARIO_INHERIT_ENV='AZURE_DEVOPS_*,T3CODE_DEV_SEED' vp run scenarios:prove scripts/scenarios/azure-viewer-38069.e2e.ts --base 786cf6a7368f7d3ab577b5a8253604b7d74b83ef --head cde81e7a2a057d98b2e38ccbe66f9933cb28bb97 --upload-command 'ghdrop upload'
