diff --git a/pkg/runner/action.go b/pkg/runner/action.go index e004aafc..6f04f90b 100644 --- a/pkg/runner/action.go +++ b/pkg/runner/action.go @@ -1,6 +1,7 @@ package runner import ( + "archive/tar" "context" "embed" "errors" @@ -133,7 +134,22 @@ func maybeCopyToActionDir(ctx context.Context, step actionStep, actionPath strin containerActionDirCopy += `/` } + content, err := rc.JobContainer.GetContainerArchive(ctx, containerActionDirCopy) + if err == nil { + defer content.Close() + if _, err := tar.NewReader(content).Next(); err == nil { + logger.Debugf("Skipping copy because actiondir has been already copied") + return nil + } + } + raction := step.(*stepActionRemote) + defer func() { + raction.copyDone = true + }() + if raction.copyDone { + return nil + } ta, err := rc.getActionCache().GetTarArchive(ctx, raction.cacheDir, raction.resolvedSha, "") if err != nil { return err diff --git a/pkg/runner/step_action_remote.go b/pkg/runner/step_action_remote.go index 8f9df270..fb76ed68 100644 --- a/pkg/runner/step_action_remote.go +++ b/pkg/runner/step_action_remote.go @@ -27,6 +27,7 @@ type stepActionRemote struct { remoteAction *remoteAction cacheDir string resolvedSha string + copyDone bool } func (sar *stepActionRemote) prepareActionExecutor() common.Executor {