# Use gh as a credential helper
exec gh auth setup-git

# 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
cd $SCRIPT_NAME-$RANDOM_STRING
exec git config user.email "test@example.com"
exec git config user.name "Test User"

# Add some commits to generate notes from
mv ../feature.txt feature.txt
exec git add .
exec git commit -m 'Add new feature'
exec git push origin main

# Create a release with generated notes
exec gh release create v1.0.0 --generate-notes

# View the release and verify it was created with a body
exec gh release view v1.0.0
stdout 'v1.0.0'

# Verify the body contains generated notes (check with JSON)
exec gh release view v1.0.0 --json body --jq '.body'
stdout 'Changed'

-- feature.txt --
New feature content
