Automattic / team51-cli

A tool for provisioning and connecting GitHub repos, Pressable WordPress sites and DeployHQ.
MIT License
12 stars 0 forks source link

Duplicate repo slugs cause `create-repository` subcommand to fail ungracefully #1

Closed mdrovdahl closed 4 years ago

mdrovdahl commented 4 years ago
  1. Run team51 create-repository --repo-slug=example using a repo slug which already exists
  2. Script fails, but error messaging doesn't indicate why, only "Failed to create GitHub repository example. Aborting!" see below
  3. Re-running the same command then surfaces the proper error message? see further below
Checking for updates..
Already up-to-date.
Creating scaffold/example directory.
Copying scaffold/templates/github directory to scaffold/example/.github.
Copying scaffold/templates/gitignore file to scaffold/example/.gitignore.
Copying scaffold/templates/.travis.yml file to scaffold/example/.travis.yml.
Copying scaffold/templates/Makefile file to scaffold/example/Makefile.
Copying scaffold/templates/EXAMPLE-README.md file to scaffold/example/README.md.
Creating repository README.
Adding custom theme slug example to .gitignore.
Local setup complete! Now we need to create and populate the repository on GitHub.
Creating GitHub repository.
Failed to create GitHub repository example. Aborting!
PHP Notice:  Trying to get property 'ssh_url' of non-object in /home/mark.drovdahl/bin/team51-cli/src/commands/create-repository.php on line 136
PHP Notice:  Trying to get property 'html_url' of non-object in /home/mark.drovdahl/bin/team51-cli/src/commands/create-repository.php on line 137
Adding, committing, and pushing files to GitHub.
 0/6 [>---------------------------]   0%
In create-repository.php line 299:

  The command "'git' 'pull' 'origin' 'master'" failed.               

  Exit Code: 1(General error)                                        

  Working directory: scaffold/example                               

  Output:                                                            
  ================                                                   

  Error Output:                                                      
  ================                                                   
  fatal: No path specified. See 'man git-pull' for valid url syntax  

create-repository [--issue-repo-only] [--repo-slug REPO-SLUG] [--production-url PRODUCTION-URL] [--development-url DEVELOPMENT-URL] [--repo-description REPO-DESCRIPTION] [--reset] [--custom-theme-slug CUSTOM-THEME-SLUG] [--custom-plugin-slug CUSTOM-PLUGIN-SLUG] [--create-production-site]

2nd run

Checking for updates..
Already up-to-date.
Creating scaffold/example directory.
Copying scaffold/templates/github directory to scaffold/example/.github.
Copying scaffold/templates/gitignore file to scaffold/example/.gitignore.
Copying scaffold/templates/.travis.yml file to scaffold/example/.travis.yml.
Copying scaffold/templates/Makefile file to scaffold/example/Makefile.
Copying scaffold/templates/EXAMPLE-README.md file to scaffold/example/README.md.
Creating repository README.
Adding custom theme slug example to .gitignore.
Local setup complete! Now we need to create and populate the repository on GitHub.
Creating GitHub repository.
Failed to create GitHub repository example. Aborting!
PHP Notice:  Trying to get property 'ssh_url' of non-object in /home/mark.drovdahl/bin/team51-cli/src/commands/create-repository.php on line 136
PHP Notice:  Trying to get property 'html_url' of non-object in /home/mark.drovdahl/bin/team51-cli/src/commands/create-repository.php on line 137
Adding, committing, and pushing files to GitHub.
 0/6 [>---------------------------]   0%
In create-repository.php line 299:

  The command "'git' 'remote' 'add' 'origin' """ failed.  

  Exit Code: 128(Invalid exit argument)                   

  Working directory: scaffold/example                    

  Output:                                                 
  ================                                        

  Error Output:                                           
  ================                                        
  fatal: remote origin already exists.                    

create-repository [--issue-repo-only] [--repo-slug REPO-SLUG] [--production-url PRODUCTION-URL] [--development-url DEVELOPMENT-URL] [--repo-description REPO-DESCRIPTION] [--reset] [--custom-theme-slug CUSTOM-THEME-SLUG] [--custom-plugin-slug CUSTOM-PLUGIN-SLUG] [--create-production-site]
mdrovdahl commented 4 years ago

Probably needs further testing...

spencermorin commented 4 years ago

Done in https://github.com/Automattic/team51-cli/pull/17!