#!/usr/bin/env bash
# Load the test account variables before running. Argument 1 is a new clone directory.
set -eu
repository="${AZURE_DEVOPS_TEST_ORG}/${AZURE_DEVOPS_TEST_PROJECT}/_git/t3-factory-test"
helper='!f() { echo username=pat; echo "password=$AZURE_DEVOPS_EXT_PAT"; }; f'
git -c credential.helper="$helper" clone "$repository" "$1"
cd "$1"
git switch -c evidence-44651-files-tab
printf 'export const filesTabEvidence = true;\n' > azure-files-tab.ts
git add azure-files-tab.ts
git -c user.name=Scenario -c user.email=scenario@example.invalid commit -m 'Add Files tab evidence sample'
git -c credential.helper="$helper" push origin HEAD
az repos pr create --organization "$AZURE_DEVOPS_TEST_ORG" --project "$AZURE_DEVOPS_TEST_PROJECT" --repository t3-factory-test --source-branch evidence-44651-files-tab --target-branch main --title 'Files tab link evidence 44651' --description 'Synthetic one-file sample for Files tab navigation proof.' --query '{id:pullRequestId,url:repository.webUrl}' -o json
# This run returned pull request 509. Set AZURE_EVIDENCE_CLONE to this clone for the scenario.
# Inherit AZURE_DEVOPS_* and AZURE_EVIDENCE_CLONE through T3_SCENARIO_INHERIT_ENV.
