@@ -5,13 +5,11 @@ import (
55 "errors"
66 "fmt"
77 "io"
8- "net/http"
98 "os"
109 "path"
1110 "path/filepath"
1211 "regexp"
1312 "strings"
14- "time"
1513
1614 gogit "github.com/go-git/go-git/v5"
1715
@@ -20,8 +18,6 @@ import (
2018 "github.com/nektos/act/pkg/model"
2119)
2220
23- var detectActionClient = http.Client {Timeout : 5 * time .Second }
24-
2521type stepActionRemote struct {
2622 Step * model.Step
2723 RunContext * RunContext
@@ -61,14 +57,9 @@ func (sar *stepActionRemote) prepareActionExecutor() common.Executor {
6157 }
6258 }
6359
64- cloneURL , err := sar .remoteAction .GetAvailableCloneURL (sar .RunContext .Config .DefaultActionsURLs )
65- if err != nil {
66- return fmt .Errorf ("failed to get available clone url of [%s] action, error: %w" , sar .Step .Uses , err )
67- }
68-
6960 actionDir := fmt .Sprintf ("%s/%s" , sar .RunContext .ActionCacheDir (), safeFilename (sar .Step .Uses ))
7061 gitClone := stepActionRemoteNewCloneExecutor (git.NewGitCloneExecutorInput {
71- URL : cloneURL ,
62+ URL : sar . remoteAction . CloneURL ( sar . RunContext . Config . DefaultActionInstance ) ,
7263 Ref : sar .remoteAction .Ref ,
7364 Dir : actionDir ,
7465 Token : "" , /*
@@ -237,32 +228,6 @@ func (ra *remoteAction) IsCheckout() bool {
237228 return false
238229}
239230
240- func (ra * remoteAction ) GetAvailableCloneURL (actionURLs []string ) (string , error ) {
241- if ra .URL != "" {
242- return ra .CloneURL (ra .URL ), nil
243- }
244- for _ , u := range actionURLs {
245- cloneURL := ra .CloneURL (u )
246- resp , err := detectActionClient .Get (cloneURL )
247- if err != nil {
248- return "" , err
249- }
250- defer resp .Body .Close ()
251-
252- switch resp .StatusCode {
253- case http .StatusOK :
254- return cloneURL , nil
255- case http .StatusNotFound :
256- continue
257-
258- default :
259- return "" , fmt .Errorf ("unexpected http status code: %d" , resp .StatusCode )
260- }
261- }
262-
263- return "" , fmt .Errorf ("no available url found" )
264- }
265-
266231func newRemoteAction (action string ) * remoteAction {
267232 // support http(s)://host/owner/repo@v3
268233 for _ , schema := range []string {"https://" , "http://" } {
0 commit comments