#!/usr/bin/env bash
set -eu
# Load the authorized Azure test environment before running this script.
: "${AZURE_DEVOPS_EXT_PAT:?}" "${AZURE_DEVOPS_TEST_ORG:?}" "${AZURE_DEVOPS_TEST_PROJECT:?}"
work=$(mktemp -d)
repo=$(az repos show --repository t3-factory-test --organization "$AZURE_DEVOPS_TEST_ORG" --project "$AZURE_DEVOPS_TEST_PROJECT" --query remoteUrl -o tsv)
git -c credential.helper='!f() { echo username=pat; echo "password=$AZURE_DEVOPS_EXT_PAT"; }; f' clone "$repo" "$work/repo"
cd "$work/repo"
git checkout -b proof-45001-brackets-2
git -c user.name=Scenario -c user.email=scenario@example.invalid commit --allow-empty -m 'Media label proof'
git -c credential.helper='!f() { echo username=pat; echo "password=$AZURE_DEVOPS_EXT_PAT"; }; f' push origin proof-45001-brackets-2
az repos pr create --organization "$AZURE_DEVOPS_TEST_ORG" --project "$AZURE_DEVOPS_TEST_PROJECT" --repository t3-factory-test --source-branch proof-45001-brackets-2 --target-branch main --title 'Media label brackets proof 45001' --description '[Demo [v2]](https://www.w3schools.com/html/mov_bbb.mp4)' '' '[Demo v2](https://www.w3schools.com/html/mov_bbb.mp4)'
# After capturing, abandon the returned PR and delete refs/heads/proof-45001-brackets-2.
