mirror of
https://code.forgejo.org/forgejo/runner.git
synced 2025-09-15 18:57:01 +00:00
feat: use hashed uses string as cache dir name (#186)
Port of https://gitea.com/gitea/act/pulls/117 Refs forgejo/act#100 Co-authored-by: Jason Song <i@wolfogre.com> Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/186 Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
This commit is contained in:
parent
13ed94f5b7
commit
a157d24741
4 changed files with 49 additions and 6 deletions
|
@ -108,7 +108,7 @@ func (sar *stepActionRemote) prepareActionExecutor() common.Executor {
|
|||
return err
|
||||
}
|
||||
|
||||
actionDir := fmt.Sprintf("%s/%s", sar.RunContext.ActionCacheDir(), safeFilename(sar.Step.Uses))
|
||||
actionDir := filepath.Join(sar.RunContext.ActionCacheDir(), sar.Step.UsesHash())
|
||||
gitClone := stepActionRemoteNewCloneExecutor(git.NewGitCloneExecutorInput{
|
||||
URL: sar.remoteAction.CloneURL(sar.RunContext.Config.DefaultActionInstance),
|
||||
Ref: sar.remoteAction.Ref,
|
||||
|
@ -177,7 +177,7 @@ func (sar *stepActionRemote) main() common.Executor {
|
|||
return sar.RunContext.JobContainer.CopyDir(copyToPath, sar.RunContext.Config.Workdir+string(filepath.Separator)+".", sar.RunContext.Config.UseGitIgnore)(ctx)
|
||||
}
|
||||
|
||||
actionDir := fmt.Sprintf("%s/%s", sar.RunContext.ActionCacheDir(), safeFilename(sar.Step.Uses))
|
||||
actionDir := filepath.Join(sar.RunContext.ActionCacheDir(), sar.Step.UsesHash())
|
||||
|
||||
return sar.runAction(sar, actionDir, sar.remoteAction)(ctx)
|
||||
}),
|
||||
|
@ -236,7 +236,7 @@ func (sar *stepActionRemote) getActionModel() *model.Action {
|
|||
|
||||
func (sar *stepActionRemote) getCompositeRunContext(ctx context.Context) *RunContext {
|
||||
if sar.compositeRunContext == nil {
|
||||
actionDir := fmt.Sprintf("%s/%s", sar.RunContext.ActionCacheDir(), safeFilename(sar.Step.Uses))
|
||||
actionDir := filepath.Join(sar.RunContext.ActionCacheDir(), sar.Step.UsesHash())
|
||||
actionLocation := path.Join(actionDir, sar.remoteAction.Path)
|
||||
_, containerActionDir := getContainerActionPaths(sar.getStepModel(), actionLocation, sar.RunContext)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue