Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix open pull request against the wrong branch #421

Merged
merged 11 commits into from
Aug 9, 2023
Prev Previous commit
Next Next commit
Fix open pull request against the wrong branch
  • Loading branch information
omerzi committed Aug 7, 2023
commit db01835ddc04fa56e6c19387b51041c94026203d
14 changes: 7 additions & 7 deletions commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ type FrogbotCommand interface {
}

func Exec(command FrogbotCommand, name string) (err error) {
// Get frogbotUtils that contains the config, server, and VCS client
// Get frogbotDetails that contains the config, server, and VCS client
log.Info("Frogbot version:", utils.FrogbotVersion)
frogbotUtils, err := utils.GetFrogbotDetails(name)
frogbotDetails, err := utils.GetFrogbotDetails(name)
if err != nil {
return err
}

// Build the server configuration file
originalJfrogHomeDir, tempJFrogHomeDir, err := utils.BuildServerConfigFile(frogbotUtils.ServerDetails)
originalJfrogHomeDir, tempJFrogHomeDir, err := utils.BuildServerConfigFile(frogbotDetails.ServerDetails)
if err != nil {
return err
}
Expand All @@ -36,8 +36,8 @@ func Exec(command FrogbotCommand, name string) (err error) {

// Set releases remote repository env if needed
previousReleasesRepoEnv := os.Getenv(coreutils.ReleasesRemoteEnv)
if frogbotUtils.ReleasesRepo != "" {
if err = os.Setenv(coreutils.ReleasesRemoteEnv, fmt.Sprintf("frogbot/%s", frogbotUtils.ReleasesRepo)); err != nil {
if frogbotDetails.ReleasesRepo != "" {
if err = os.Setenv(coreutils.ReleasesRemoteEnv, fmt.Sprintf("frogbot/%s", frogbotDetails.ReleasesRepo)); err != nil {
return
}
defer func() {
Expand All @@ -47,11 +47,11 @@ func Exec(command FrogbotCommand, name string) (err error) {

// Send a usage report
usageReportSent := make(chan error)
go utils.ReportUsage(name, frogbotUtils.ServerDetails, usageReportSent)
go utils.ReportUsage(name, frogbotDetails.ServerDetails, usageReportSent)

// Invoke the command interface
log.Info(fmt.Sprintf("Running Frogbot %q command", name))
err = command.Run(frogbotUtils.Repositories, frogbotUtils.GitClient)
err = command.Run(frogbotDetails.Repositories, frogbotDetails.GitClient)

// Wait for a signal, letting us know that the usage reporting is done.
<-usageReportSent
Expand Down
2 changes: 1 addition & 1 deletion commands/utils/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func validateHashPlaceHolder(template string) error {
return nil
}

func GetFrogbotDetails(commandName string) (frogbotUtils *FrogbotDetails, err error) {
func GetFrogbotDetails(commandName string) (frogbotDetails *FrogbotDetails, err error) {
// Get server and git details
jfrogServer, err := extractJFrogCredentialsFromEnvs()
if err != nil {
Expand Down