Skip to content

Commit

Permalink
Update host
Browse files Browse the repository at this point in the history
  • Loading branch information
kyma-bot committed Oct 11, 2024
1 parent 5ad5cb7 commit 32c55d0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/github/bumper/bumper.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,6 @@ func validateOptions(o *Options) error {
o.HeadBranchName = defaultHeadBranchName
}
}
if o.GitHubHost == "" {
o.GitHubHost = "github.com"
}

return nil
}
Expand All @@ -270,13 +267,15 @@ func processGitHub(o *Options, prh PRHandler) error {
return fmt.Errorf("start secrets agent: %w", err)
}

githubHost := "github.com"
gitHubGraphQLEndpoint := github.DefaultGraphQLEndpoint
gitHubAPIEndpoint := github.DefaultAPIEndpoint
if o.GitHubHost != "" {
// Override the default endpoints if a custom GitHub host is provided.
// Use default endpoint for GitHub Enterprise Server.
// See: https://docs.github.com/en/enterprise-server@3.12/rest/quickstart?apiVersion=2022-11-28#using-curl-in-the-command-line
// See: https://docs.github.com/en/enterprise-server@3.12/graphql/overview/about-the-graphql-api
githubHost = o.GitHubHost
gitHubAPIEndpoint = fmt.Sprintf("https://%s/api/v3", o.GitHubHost)
gitHubGraphQLEndpoint = fmt.Sprintf("https://%s/api/graphql", o.GitHubHost)
}
Expand Down Expand Up @@ -325,7 +324,7 @@ func processGitHub(o *Options, prh PRHandler) error {
}
}

remote := fmt.Sprintf("https://%s:%s@%s/%s/%s.git", o.GitHubLogin, string(secret.GetTokenGenerator(o.GitHubToken)()), o.GitHubHost, o.GitHubLogin, o.RemoteName)
remote := fmt.Sprintf("https://%s:%s@%s/%s/%s.git", o.GitHubLogin, string(secret.GetTokenGenerator(o.GitHubToken)()), githubHost, o.GitHubLogin, o.RemoteName)
if err := gitPush(remote, o.HeadBranchName, stdout, stderr, o.SkipPullRequest); err != nil {
return fmt.Errorf("push changes to the remote branch: %w", err)
}
Expand Down

0 comments on commit 32c55d0

Please sign in to comment.