From 9d7ffe91aaa1b6f6561f7f9f6b49d948257972c0 Mon Sep 17 00:00:00 2001 From: Postmodern Date: Sat, 13 Apr 2024 21:23:37 -0700 Subject: [PATCH] Fixed `ronin-repos new` specs when ran in the CI environment. * Set the `git` `user.name` and `user.email`, if not already set, so that the `git commit` command succeeds when ran in the CI environment. --- spec/cli/commands/new_spec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spec/cli/commands/new_spec.rb b/spec/cli/commands/new_spec.rb index e94855c..0c011e2 100644 --- a/spec/cli/commands/new_spec.rb +++ b/spec/cli/commands/new_spec.rb @@ -13,8 +13,19 @@ @name = 'new-repo' @path = File.join(@root,@name) + @git_name = `git config --global user.name` + @git_email = `git config --global user.email` @github_user = Ronin::Core::Git.github_user || ENV['USER'] + if @git_name.empty? + # ensure that we set the git author name and email in the CI + @git_name = 'Test User' + @git_email = 'test@example.com' + + system('git','config','--global','user.name',@git_name) + system('git','config','--global','user.email',@git_email) + end + described_class.main(@path) end