# Create a repository with a file so it has a default branch
exec gh repo create $ORG/$SCRIPT_NAME-$RANDOM_STRING --add-readme --private

# Defer repo cleanup
defer gh repo delete --yes $ORG/$SCRIPT_NAME-$RANDOM_STRING

# Clone the repo
exec gh repo clone $ORG/$SCRIPT_NAME-$RANDOM_STRING

# Create an issue in the repo
cd $SCRIPT_NAME-$RANDOM_STRING
# Create a repo-local label name so the test stays stable even when new repos
# already include GitHub's default labels (for example "bug").
exec gh label create acceptance-bug --color d73a4a --description 'Something is broken'
exec gh issue create --title 'Feature Request' --body 'Feature Body' --assignee '@me' --label 'acceptance-bug'
stdout2env ISSUE_URL

# Check the issue was create
exec gh issue view $ISSUE_URL
stdout 'title:\tFeature Request$'
stdout 'assignees:\t.+$'
stdout 'labels:\tacceptance-bug$'
