1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-09-15 18:57:01 +00:00

fix action cloning, set correct server_url for act_runner exec (#68)

1. Newest act is not able to clone action based on --default-actions-url
It might be side effect of https://gitea.com/gitea/act/pulls/67.
2. Set correct server_url, api_url, graphql_url for act_runner exec

Reviewed-on: https://gitea.com/gitea/act/pulls/68
Reviewed-by: Jason Song <i@wolfogre.com>
Co-authored-by: Tomasz Duda <tomaszduda23@gmail.com>
Co-committed-by: Tomasz Duda <tomaszduda23@gmail.com>
This commit is contained in:
Tomasz Duda 2023-06-20 07:36:10 +00:00 committed by Jason Song
parent fe7427ebb9
commit 23edaa4f80
2 changed files with 16 additions and 7 deletions

View file

@ -49,8 +49,6 @@ func (sar *stepActionRemote) prepareActionExecutor() common.Executor {
}
github := sar.getGithubContext(ctx)
sar.remoteAction.URL = github.ServerURL
if sar.remoteAction.IsCheckout() && isLocalCheckout(github, sar.Step) && !sar.RunContext.Config.NoSkipCheckout {
common.Logger(ctx).Debugf("Skipping local actions/checkout because workdir was already copied")
return nil
@ -225,11 +223,7 @@ type remoteAction struct {
Ref string
}
func (ra *remoteAction) CloneURL(defaultURL string) string {
u := ra.URL
if u == "" {
u = defaultURL
}
func (ra *remoteAction) CloneURL(u string) string {
if !strings.HasPrefix(u, "http://") && !strings.HasPrefix(u, "https://") {
u = "https://" + u
}
@ -244,6 +238,9 @@ func (ra *remoteAction) IsCheckout() bool {
}
func (ra *remoteAction) GetAvailableCloneURL(actionURLs []string) (string, error) {
if ra.URL != "" {
return ra.CloneURL(ra.URL), nil
}
for _, u := range actionURLs {
cloneURL := ra.CloneURL(u)
resp, err := detectActionClient.Get(cloneURL)