Move url logic entirely into getGithubContext
This commit is contained in:
parent
5163d401dc
commit
9f2b142992
1 changed files with 2 additions and 12 deletions
|
|
@ -1208,7 +1208,7 @@ func (rc *RunContext) getGithubContext(ctx context.Context) *model.GithubContext
|
|||
ghc.RetentionDays = preset.RetentionDays
|
||||
|
||||
instance := rc.Config.GitHubInstance
|
||||
if !strings.HasPrefix(instance, "http://") &&
|
||||
if instance != "" && !strings.HasPrefix(instance, "http://") &&
|
||||
!strings.HasPrefix(instance, "https://") {
|
||||
instance = "https://" + instance
|
||||
}
|
||||
|
|
@ -1251,7 +1251,7 @@ func (rc *RunContext) getGithubContext(ctx context.Context) *model.GithubContext
|
|||
|
||||
{ // Adapt to Gitea
|
||||
instance := rc.Config.GitHubInstance
|
||||
if !strings.HasPrefix(instance, "http://") &&
|
||||
if instance != "" && !strings.HasPrefix(instance, "http://") &&
|
||||
!strings.HasPrefix(instance, "https://") {
|
||||
instance = "https://" + instance
|
||||
}
|
||||
|
|
@ -1353,16 +1353,6 @@ func (rc *RunContext) withGithubEnv(ctx context.Context, github *model.GithubCon
|
|||
set("SERVER_URL", github.ServerURL)
|
||||
set("API_URL", github.APIURL)
|
||||
|
||||
{ // Adapt to Forgejo
|
||||
instance := rc.Config.GitHubInstance
|
||||
if instance != "" && !strings.HasPrefix(instance, "http://") &&
|
||||
!strings.HasPrefix(instance, "https://") {
|
||||
instance = "https://" + instance
|
||||
}
|
||||
set("SERVER_URL", instance)
|
||||
set("API_URL", instance+"/api/v1")
|
||||
}
|
||||
|
||||
if rc.Config.ArtifactServerPath != "" {
|
||||
setActionRuntimeVars(rc, env)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue