(rc *RunContext)
| 21 | } |
| 22 | |
| 23 | func newRemoteReusableWorkflowExecutor(rc *RunContext) common.Executor { |
| 24 | uses := rc.Run.Job().Uses |
| 25 | |
| 26 | remoteReusableWorkflow := newRemoteReusableWorkflow(uses) |
| 27 | if remoteReusableWorkflow == nil { |
| 28 | return common.NewErrorExecutor(fmt.Errorf("expected format {owner}/{repo}/.github/workflows/{filename}@{ref}. Actual '%s' Input string was not in a correct format", uses)) |
| 29 | } |
| 30 | |
| 31 | // uses with safe filename makes the target directory look something like this {owner}-{repo}-.github-workflows-{filename}@{ref} |
| 32 | // instead we will just use {owner}-{repo}@{ref} as our target directory. This should also improve performance when we are using |
| 33 | // multiple reusable workflows from the same repository and ref since for each workflow we won't have to clone it again |
| 34 | filename := fmt.Sprintf("%s/%s@%s", remoteReusableWorkflow.Org, remoteReusableWorkflow.Repo, remoteReusableWorkflow.Ref) |
| 35 | workflowDir := fmt.Sprintf("%s/%s", rc.ActionCacheDir(), safeFilename(filename)) |
| 36 | |
| 37 | if rc.Config.ActionCache != nil { |
| 38 | return newActionCacheReusableWorkflowExecutor(rc, filename, remoteReusableWorkflow) |
| 39 | } |
| 40 | |
| 41 | return common.NewPipelineExecutor( |
| 42 | newMutexExecutor(cloneIfRequired(rc, *remoteReusableWorkflow, workflowDir)), |
| 43 | newReusableWorkflowExecutor(rc, workflowDir, fmt.Sprintf("./.github/workflows/%s", remoteReusableWorkflow.Filename)), |
| 44 | ) |
| 45 | } |
| 46 | |
| 47 | func newActionCacheReusableWorkflowExecutor(rc *RunContext, filename string, remoteReusableWorkflow *remoteReusableWorkflow) common.Executor { |
| 48 | return func(ctx context.Context) error { |
no test coverage detected
searching dependent graphs…