Skip to content

Commit

Permalink
fix: subpath actions via new artifact cache (#2170)
Browse files Browse the repository at this point in the history
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
ChristopherHX and mergify[bot] committed Jan 28, 2024
1 parent a6ec2c1 commit 09d4b5d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions pkg/runner/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,27 +125,28 @@ 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, "")
if err != nil {
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)
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/runner/step_action_remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 09d4b5d

Please sign in to comment.