fix(pr create): use REPO var in AT

This commit is contained in:
Kynan Ware 2025-03-12 10:43:06 -06:00
parent 6004fc2cd8
commit bdfec50186

View file

@ -1,17 +1,20 @@
# Use gh as a credential helper
exec gh auth setup-git
# Setup environment variables used for testscript
env REPO=${SCRIPT_NAME}-${RANDOM_STRING}
# Create a repository with a file so it has a default branch
exec gh repo create ${ORG}/${SCRIPT_NAME}-${RANDOM_STRING} --add-readme --private
exec gh repo create ${ORG}/${REPO} --add-readme --private
# Defer repo cleanup
defer gh repo delete --yes ${ORG}/${SCRIPT_NAME}-${RANDOM_STRING}
defer gh repo delete --yes ${ORG}/${REPO}
# Clone the repo
exec gh repo clone ${ORG}/${SCRIPT_NAME}-${RANDOM_STRING}
exec gh repo clone ${ORG}/${REPO}
# Prepare a branch to PR
cd ${SCRIPT_NAME}-${RANDOM_STRING}
cd ${REPO}
exec git checkout -b feature-branch
exec git commit --allow-empty -m 'Empty Commit'
exec git push -u origin feature-branch
@ -20,5 +23,5 @@ exec git push -u origin feature-branch
cd ${WORK}
# Create the PR
exec gh pr create --title 'Feature Title' --body 'Feature Body' --repo ${ORG}/${SCRIPT_NAME}-${RANDOM_STRING} --head feature-branch
stdout https://${GH_HOST}/${ORG}/${SCRIPT_NAME}-${RANDOM_STRING}/pull/1
exec gh pr create --title 'Feature Title' --body 'Feature Body' --repo ${ORG}/${REPO} --head feature-branch
stdout https://${GH_HOST}/${ORG}/${REPO}/pull/1