MCPcopy
hub / github.com/nektos/act / newRemoteReusableWorkflowExecutor

Function newRemoteReusableWorkflowExecutor

pkg/runner/reusable_workflow.go:23–45  ·  view source on GitHub ↗
(rc *RunContext)

Source from the content-addressed store, hash-verified

21}
22
23func 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
47func newActionCacheReusableWorkflowExecutor(rc *RunContext, filename string, remoteReusableWorkflow *remoteReusableWorkflow) common.Executor {
48 return func(ctx context.Context) error {

Callers 1

ExecutorMethod · 0.85

Calls 10

NewErrorExecutorFunction · 0.92
NewPipelineExecutorFunction · 0.92
safeFilenameFunction · 0.85
newMutexExecutorFunction · 0.85
cloneIfRequiredFunction · 0.85
JobMethod · 0.80
ActionCacheDirMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…