Added test function for repos and repo-create test

This commit is contained in:
Tyler McGoffin 2024-10-16 15:14:18 -07:00
parent 1313612245
commit 18428671c3
2 changed files with 20 additions and 0 deletions

View file

@ -72,6 +72,14 @@ func TestReleases(t *testing.T) {
testscript.Run(t, testScriptParamsFor(tsEnv, "release"))
}
func TestRepos(t *testing.T) {
var tsEnv testScriptEnv
if err := tsEnv.fromEnv(); err != nil {
t.Fatal(err)
}
testscript.Run(t, testScriptParamsFor(tsEnv, "repos"))
}
func testScriptParamsFor(tsEnv testScriptEnv, command string) testscript.Params {
var files []string
if tsEnv.script != "" {

View file

@ -0,0 +1,12 @@
# 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
# Check that the repo exists
exec gh repo view $ORG/$SCRIPT_NAME-$RANDOM_STRING --json name --jq '.name'
stdout $SCRIPT_NAME-$RANDOM_STRING