diff options
author | ChristopherHX <christopher.homberger@web.de> | 2024-01-28 17:49:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-28 17:49:47 +0100 |
commit | 09d4b5d6ade1a06fa006a0fb202f9ff8c19c33f6 (patch) | |
tree | c08b6b444293b45816dbfc9e8cacb34099a0560a /pkg | |
parent | fix: improve action not found error (#2171) (diff) | |
download | forgejo-act-09d4b5d6ade1a06fa006a0fb202f9ff8c19c33f6.tar.xz forgejo-act-09d4b5d6ade1a06fa006a0fb202f9ff8c19c33f6.zip |
fix: subpath actions via new artifact cache (#2170)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/runner/action.go | 17 | ||||
-rw-r--r-- | pkg/runner/step_action_remote.go | 2 |
2 files changed, 10 insertions, 9 deletions
diff --git a/pkg/runner/action.go b/pkg/runner/action.go index 42742c4..9b14f1a 100644 --- a/pkg/runner/action.go +++ b/pkg/runner/action.go @@ -125,6 +125,14 @@ func maybeCopyToActionDir(ctx context.Context, step actionStep, actionDir string return nil } + var containerActionDirCopy string + containerActionDirCopy = strings.TrimSuffix(containerActionDir, actionPath) + logger.Debug(containerActionDirCopy) + + if !strings.HasSuffix(containerActionDirCopy, `/`) { + containerActionDirCopy += `/` + } + if rc.Config != nil && rc.Config.ActionCache != nil { raction := step.(*stepActionRemote) ta, err := rc.Config.ActionCache.GetTarArchive(ctx, raction.cacheDir, raction.resolvedSha, "") @@ -132,20 +140,13 @@ func maybeCopyToActionDir(ctx context.Context, step actionStep, actionDir string return err } defer ta.Close() - return rc.JobContainer.CopyTarStream(ctx, containerActionDir, ta) + return rc.JobContainer.CopyTarStream(ctx, containerActionDirCopy, ta) } if err := removeGitIgnore(ctx, actionDir); err != nil { return err } - var containerActionDirCopy string - containerActionDirCopy = strings.TrimSuffix(containerActionDir, actionPath) - logger.Debug(containerActionDirCopy) - - if !strings.HasSuffix(containerActionDirCopy, `/`) { - containerActionDirCopy += `/` - } return rc.JobContainer.CopyDir(containerActionDirCopy, actionDir+"/", rc.Config.UseGitIgnore)(ctx) } diff --git a/pkg/runner/step_action_remote.go b/pkg/runner/step_action_remote.go index 5c8a8f2..7d0caa8 100644 --- a/pkg/runner/step_action_remote.go +++ b/pkg/runner/step_action_remote.go @@ -75,7 +75,7 @@ func (sar *stepActionRemote) prepareActionExecutor() common.Executor { remoteReader := func(ctx context.Context) actionYamlReader { return func(filename string) (io.Reader, io.Closer, error) { - spath := filename + spath := path.Join(sar.remoteAction.Path, filename) for i := 0; i < maxSymlinkDepth; i++ { tars, err := cache.GetTarArchive(ctx, sar.cacheDir, sar.resolvedSha, spath) if err != nil { |