From e0f087ca2b2b6cb2e2cb2360e497c7e19c2b9365 Mon Sep 17 00:00:00 2001 From: Ali AKCA Date: Wed, 8 Nov 2023 13:13:17 +0100 Subject: [PATCH] feat: accept containers to execute actions (#180) * refactor: remove no-op `workflows` from module * refactor: use base container for config * feat: accept containers to execute actions * docs: update README.md * refactor: update actions/runtime with new gale DX * docs: add changie notes --- .../unreleased/Added-20231108-121519.yaml | 6 + .../unreleased/Breaking-20231108-120544.yaml | 6 + .../unreleased/Changed-20231108-121439.yaml | 7 + README.md | 87 ++++++------ daggerverse/actions/runtime/action_run.go | 17 ++- .../actions/runtime/actions_runtime.go | 9 +- daggerverse/actions/runtime/go.mod | 2 +- daggerverse/actions/runtime/go.sum | 4 +- daggerverse/gale/gale.go | 124 ++++++++++++++++- daggerverse/gale/helpers.go | 1 + daggerverse/gale/repo.go | 56 ++++++++ daggerverse/gale/workflow_run.go | 8 +- daggerverse/gale/workflows.go | 128 ------------------ 13 files changed, 266 insertions(+), 189 deletions(-) create mode 100644 .changes/unreleased/Added-20231108-121519.yaml create mode 100644 .changes/unreleased/Breaking-20231108-120544.yaml create mode 100644 .changes/unreleased/Changed-20231108-121439.yaml create mode 100644 daggerverse/gale/repo.go delete mode 100644 daggerverse/gale/workflows.go diff --git a/.changes/unreleased/Added-20231108-121519.yaml b/.changes/unreleased/Added-20231108-121519.yaml new file mode 100644 index 00000000..30e6ee97 --- /dev/null +++ b/.changes/unreleased/Added-20231108-121519.yaml @@ -0,0 +1,6 @@ +kind: Added +body: Introduced a new `--container` option to specify the container type for runners. +time: 2023-11-08T12:15:19.019065+01:00 +custom: + Author: aweris + PR: "180" diff --git a/.changes/unreleased/Breaking-20231108-120544.yaml b/.changes/unreleased/Breaking-20231108-120544.yaml new file mode 100644 index 00000000..a5a16f45 --- /dev/null +++ b/.changes/unreleased/Breaking-20231108-120544.yaml @@ -0,0 +1,6 @@ +kind: Breaking +body: Removed the `workflows` subcommand from the module. `list` and `run` commands are now available directly under module root. +time: 2023-11-08T12:05:44.825203+01:00 +custom: + Author: aweris + PR: "180" diff --git a/.changes/unreleased/Changed-20231108-121439.yaml b/.changes/unreleased/Changed-20231108-121439.yaml new file mode 100644 index 00000000..8ab67e62 --- /dev/null +++ b/.changes/unreleased/Changed-20231108-121439.yaml @@ -0,0 +1,7 @@ +kind: Changed +body: Renamed the command line option `--runner-image` to `--image`. This change affects + all commands where `--runner-image` was previously used. +time: 2023-11-08T12:14:39.28384+01:00 +custom: + Author: aweris + PR: "180" diff --git a/README.md b/README.md index a2b2bbd4..d6f7efa9 100644 --- a/README.md +++ b/README.md @@ -48,19 +48,18 @@ To get a list of workflows, you can use the dagger call workflows list command. Below is the help output showing the usage and options: ```shell - Usage: - dagger call workflows list [flags] - - Aliases: - list, List - - Flags: - --branch string Git branch to checkout. Used with --repo. If tag and branch are both specified, tag takes precedence. - -h, --help help for list - --repo string Name of the repository. Format: owner/name. - --source Directory Directory containing the repository source. Has precedence over repo. - --tag string Git tag to checkout. Used with --repo. If tag and branch are both specified, tag takes precedence. - --workflows-dir string Path to the workflow directory. (default ".github/workflows") +List returns a list of workflows and their jobs with the given options. + +Usage: + dagger call list [flags] + +Flags: + --branch string Branch name to check out. Only one of branch or tag can be used. Precedence is as follows: tag, branch. + -h, --help help for list + --repo string The name of the repository. Format: owner/name. + --source Directory The directory containing the repository source. If source is provided, rest of the options are ignored. + --tag string Tag name to check out. Only one of branch or tag can be used. Precedence is as follows: tag, branch. + --workflows-dir string Path to the workflows' directory. (default: .github/workflows) ``` #### Examples @@ -68,46 +67,48 @@ Below is the help output showing the usage and options: List all workflows for current repository: ```shell -dagger call workflows list --source "." +dagger call list --source "." ``` List workflows for a specific repository and directory: ```shell -dagger call workflows list --repo aweris/gale --branch main --workflows-dir examples/workflows +dagger call list --repo aweris/gale --branch main --workflows-dir examples/workflows ``` ### Run a Workflow -For running workflows, you'll mainly use `dagger [call|download] workflows run [flags] [sub-command]`. Below is +For running workflows, you'll mainly use `dagger [call|download] run [flags] [sub-command]`. Below is the help output showing the usage and options: ```shell - Usage: - dagger call workflows run [flags] - dagger call workflows run [command] - - Aliases: - run, Run - - Available Commands: - config Configuration for the workflow run. - directory Directory returns the directory of the workflow run information. - sync Sync evaluates the workflow run and returns the container at executed the workflow. - - Flags: - --branch string Git branch to checkout. Used with --repo. If tag and branch are both specified, tag takes precedence. - --event string Name of the event that triggered the workflow. (default "push") - --event-file File The file with the complete webhook json event payload. - -h, --help help for run - --job string Name of the job to run. If empty, all jobs will be run. - --repo string Name of the repository. Format: owner/name. - --runner-debug Enables debug mode. - --runner-image string Docker image to use for the runner. (default "ghcr.io/dagger/gale:latest") - --source Directory Directory containing the repository source. Has precedence over repo. - --tag string Git tag to checkout. Used with --repo. If tag and branch are both specified, tag takes precedence. - --token Secret GitHub token to use for authentication. - --workflow string Name of the workflow to run. +Run runs the workflow with the given options. + +Usage: + dagger call run [flags] + dagger call run [command] + +Available Commands: + config Configuration for the workflow run. + directory Directory returns the directory of the workflow run information. + sync Sync runs the workflow and returns the container that ran the workflow. + +Flags: + --branch string Branch name to check out. Only one of branch or tag can be used. Precedence is as follows: tag, branch. + --container Container Container to use for the runner. If --image and --container provided together, --image takes precedence. + --event string Name of the event that triggered the workflow. e.g. push + --event-file File File with the complete webhook event payload. + -h, --help help for run + --image string Image to use for the runner. If --image and --container provided together, --image takes precedence. + --job string Name of the job to run. If empty, all jobs will be run. + --repo string The name of the repository. Format: owner/name. + --runner-debug Enables debug mode. + --source Directory The directory containing the repository source. If source is provided, rest of the options are ignored. + --tag string Tag name to check out. Only one of branch or tag can be used. Precedence is as follows: tag, branch. + --token Secret GitHub token to use for authentication. + --workflow string Name of the workflow to run. + --workflow-file File External workflow file to run. + --workflows-dir string Path to the workflows directory. (default: .github/workflows) ``` #### Sub-Commands @@ -123,7 +124,7 @@ dagger call workflow run ... --workflow build sync The help output for directory option ```shell Usage: - dagger download workflows run directory [flags] + dagger download run directory [flags] Aliases: directory, Directory @@ -146,7 +147,7 @@ dagger download workflow run ... --workflow build directory --export-path .gale/ Running a workflow for remote repository and downloading exporting the workflow run data and artifacts: ```shell - dagger download --focus=false workflows run --repo kubernetes/minikube --branch master --workflow build --job build_minikube --token $GITHUB_TOKEN directory --export-path .gale/exports --include-artifacts + dagger download --focus=false run --repo kubernetes/minikube --branch master --workflow build --job build_minikube --token $GITHUB_TOKEN directory --export-path .gale/exports --include-artifacts ``` **Notes for Above Example:** diff --git a/daggerverse/actions/runtime/action_run.go b/daggerverse/actions/runtime/action_run.go index d4bfccba..ea64bc7a 100644 --- a/daggerverse/actions/runtime/action_run.go +++ b/daggerverse/actions/runtime/action_run.go @@ -1,8 +1,9 @@ package main import ( - "actions-runtime/model" "fmt" + + "actions-runtime/model" ) type ActionRun struct { @@ -38,8 +39,11 @@ type ActionRunConfig struct { // File with the complete webhook event payload. EventFile *File - // Image to use for the runner. - RunnerImage string + // Image to use for the runner. If --image and --container provided together, --image takes precedence. + Image string + + // Container to use for the runner. If --image and --container provided together, --image takes precedence. + Container *Container // Enables debug mode. RunnerDebug bool @@ -64,7 +68,7 @@ func (ar *ActionRun) Sync() (*Container, error) { return nil, err } - opts := GaleWorkflowsRunOpts{ + opts := GaleRunOpts{ Source: ar.Config.Source, Repo: ar.Config.Repo, Tag: ar.Config.Tag, @@ -72,12 +76,13 @@ func (ar *ActionRun) Sync() (*Container, error) { WorkflowFile: wf, Event: ar.Config.Event, EventFile: ar.Config.EventFile, - RunnerImage: ar.Config.RunnerImage, + Image: ar.Config.Image, + Container: ar.Config.Container, RunnerDebug: ar.Config.RunnerDebug, Token: ar.Config.Token, } - return dag.Gale().Workflows().Run(opts).Sync(), nil + return dag.Gale().Run(opts).Sync(), nil } // getWorkflowFile returns a workflow file with the given uses, env, and with. diff --git a/daggerverse/actions/runtime/actions_runtime.go b/daggerverse/actions/runtime/actions_runtime.go index acf0b3b7..d0f25ed8 100644 --- a/daggerverse/actions/runtime/actions_runtime.go +++ b/daggerverse/actions/runtime/actions_runtime.go @@ -18,8 +18,10 @@ func (m *ActionsRuntime) Run( event Optional[string], // File with the complete webhook event payload. eventFile Optional[*File], - // Image to use for the runner. - runnerImage Optional[string], + // Image to use for the runner. If --image and --container provided together, --image takes precedence. + image Optional[string], + // Container to use for the runner. If --image and --container provided together, --image takes precedence. + container Optional[*Container], // Enables debug mode. runnerDebug Optional[bool], // GitHub token to use for authentication. @@ -36,7 +38,8 @@ func (m *ActionsRuntime) Run( With: []string{}, Event: event.GetOr("push"), EventFile: eventFile.GetOr(nil), - RunnerImage: runnerImage.GetOr("ghcr.io/catthehacker/ubuntu:act-latest"), + Image: image.GetOr(""), // default value handled by gale module. Handling it here would override the container if it is provided. + Container: container.GetOr(nil), RunnerDebug: runnerDebug.GetOr(false), Token: token.GetOr(nil), }, diff --git a/daggerverse/actions/runtime/go.mod b/daggerverse/actions/runtime/go.mod index e5b67443..9c77c2b1 100644 --- a/daggerverse/actions/runtime/go.mod +++ b/daggerverse/actions/runtime/go.mod @@ -12,6 +12,6 @@ require ( github.com/stretchr/testify v1.8.3 // indirect github.com/vektah/gqlparser/v2 v2.5.6 // indirect golang.org/x/exp v0.0.0-20231006140011-7918f672742d - golang.org/x/sync v0.3.0 + golang.org/x/sync v0.4.0 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect ) diff --git a/daggerverse/actions/runtime/go.sum b/daggerverse/actions/runtime/go.sum index 1b0de41c..bc486956 100644 --- a/daggerverse/actions/runtime/go.sum +++ b/daggerverse/actions/runtime/go.sum @@ -35,8 +35,8 @@ github.com/vektah/gqlparser/v2 v2.5.6 h1:Ou14T0N1s191eRMZ1gARVqohcbe1e8FrcONScsq github.com/vektah/gqlparser/v2 v2.5.6/go.mod h1:z8xXUff237NntSuH8mLFijZ+1tjV1swDbpDqjJmk6ME= golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI= golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo= -golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= +golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= diff --git a/daggerverse/gale/gale.go b/daggerverse/gale/gale.go index 797a4198..959e66f2 100644 --- a/daggerverse/gale/gale.go +++ b/daggerverse/gale/gale.go @@ -1,8 +1,128 @@ package main +import ( + "context" + "fmt" + "strings" +) + // Gale is a Dagger module for running Github Actions workflows. type Gale struct{} -func (g *Gale) Workflows() *Workflows { - return new(Workflows) +// List returns a list of workflows and their jobs with the given options. +func (g *Gale) List( + // context to use for the operation + ctx context.Context, + // The directory containing the repository source. If source is provided, rest of the options are ignored. + source Optional[*Directory], + // The name of the repository. Format: owner/name. + repo Optional[string], + // Tag name to check out. Only one of branch or tag can be used. Precedence is as follows: tag, branch. + tag Optional[string], + // Branch name to check out. Only one of branch or tag can be used. Precedence is as follows: tag, branch. + branch Optional[string], + // Path to the workflows' directory. (default: .github/workflows) + workflowsDir Optional[string], +) (string, error) { + workflows := getWorkflowsDir(source, repo, tag, branch, workflowsDir) + + sb := strings.Builder{} + + err := walkWorkflowDir(ctx, workflowsDir, workflows, + func(ctx context.Context, path string, file *File) error { + // dagger do not support maps yet, so we're defining anonymous struct to unmarshal the yaml file to avoid + // hit this limitation. + var workflow struct { + Name string `yaml:"name"` + Jobs map[string]interface{} `yaml:"jobs"` + } + + if err := unmarshalContentsToYAML(ctx, file, &workflow); err != nil { + return err + } + + sb.WriteString("Workflow: ") + if workflow.Name != "" { + sb.WriteString(fmt.Sprintf("%s (path: %s)\n", workflow.Name, path)) + } else { + sb.WriteString(fmt.Sprintf("%s\n", path)) + } + + sb.WriteString("Jobs:\n") + + for job := range workflow.Jobs { + sb.WriteString(fmt.Sprintf(" - %s\n", job)) + } + + sb.WriteString("\n") // extra empty line + + return nil + }, + ) + + if err != nil { + return "", err + } + + return sb.String(), nil +} + +// Run runs the workflow with the given options. +func (g *Gale) Run( + // The directory containing the repository source. If source is provided, rest of the options are ignored. + source Optional[*Directory], + // The name of the repository. Format: owner/name. + repo Optional[string], + // Tag name to check out. Only one of branch or tag can be used. Precedence is as follows: tag, branch. + tag Optional[string], + // Branch name to check out. Only one of branch or tag can be used. Precedence is as follows: tag, branch. + branch Optional[string], + // Path to the workflows directory. (default: .github/workflows) + workflowsDir Optional[string], + // External workflow file to run. + workflowFile Optional[*File], + // Name of the workflow to run. + workflow Optional[string], + // Name of the job to run. If empty, all jobs will be run. + job Optional[string], + // Name of the event that triggered the workflow. e.g. push + event Optional[string], + // File with the complete webhook event payload. + eventFile Optional[*File], + // Image to use for the runner. If --image and --container provided together, --image takes precedence. + image Optional[string], + // Container to use for the runner. If --image and --container provided together, --image takes precedence. + container Optional[*Container], + // Enables debug mode. + runnerDebug Optional[bool], + // GitHub token to use for authentication. + token Optional[*Secret], +) *WorkflowRun { + var base *Container + + if image, ok := image.Get(); ok { + base = dag.Container().From(image) + } else if container, ok := container.Get(); ok { + base = container + } else { + base = dag.Container().From("ghcr.io/catthehacker/ubuntu:act-latest") + } + + return &WorkflowRun{ + Config: WorkflowRunConfig{ + Base: base, + Source: source.GetOr(nil), + Repo: repo.GetOr(""), + Branch: branch.GetOr(""), + Tag: tag.GetOr(""), + WorkflowsDir: workflowsDir.GetOr(".github/workflows"), + WorkflowFile: workflowFile.GetOr(nil), + Workflow: workflow.GetOr(""), + Job: job.GetOr(""), + Event: event.GetOr("push"), + EventFile: eventFile.GetOr(nil), + RunnerDebug: runnerDebug.GetOr(false), + Token: token.GetOr(nil), + }, + } } diff --git a/daggerverse/gale/helpers.go b/daggerverse/gale/helpers.go index e1c748cf..7be4b5c0 100644 --- a/daggerverse/gale/helpers.go +++ b/daggerverse/gale/helpers.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "gopkg.in/yaml.v3" ) diff --git a/daggerverse/gale/repo.go b/daggerverse/gale/repo.go new file mode 100644 index 00000000..b5bd1850 --- /dev/null +++ b/daggerverse/gale/repo.go @@ -0,0 +1,56 @@ +package main + +import ( + "context" + "path/filepath" + "strings" +) + +// getRepoInfo returns the repository info from the given options. +func getRepoInfo(source Optional[*Directory], repo, tag, branch Optional[string]) *RepoInfo { + // convert workflows list options to repo source options + opts := RepoInfoOpts{ + Source: source.GetOr(nil), + Repo: repo.GetOr(""), + Tag: tag.GetOr(""), + Branch: branch.GetOr(""), + } + + // get the repository source working directory from the options -- default value handled by the repo module, so we + // don't need to handle it here. + return dag.Repo().Info(opts) +} + +// getWorkflowsDir returns the workflows directory from the given options. +func getWorkflowsDir(source Optional[*Directory], repo, tag, branch, workflowsDir Optional[string]) *Directory { + info := getRepoInfo(source, repo, tag, branch) + + // get the repository source working directory from the options -- default value handled by the repo module, so we + // don't need to handle it here. + return info.WorkflowsDir(RepoInfoWorkflowsDirOpts{WorkflowsDir: workflowsDir.GetOr("")}) +} + +// WorkflowWalkFunc is the type of the function called for each workflow file visited by walkWorkflowDir. +type WorkflowWalkFunc func(ctx context.Context, path string, file *File) error + +// walkWorkflowDir walks the workflows directory and calls the given function for each workflow file. +func walkWorkflowDir(ctx context.Context, path Optional[string], dir *Directory, fn WorkflowWalkFunc) error { + entries, err := dir.Entries(ctx) + if err != nil { + return err + } + + for _, entry := range entries { + // load only .yaml and .yml files + if strings.HasSuffix(entry, ".yaml") || strings.HasSuffix(entry, ".yml") { + file := dir.File(entry) + path := filepath.Join(path.GetOr(".github/workflows"), entry) + + if err := fn(ctx, path, file); err != nil { + return err + } + } + } + + return nil +} diff --git a/daggerverse/gale/workflow_run.go b/daggerverse/gale/workflow_run.go index 155975da..c0e89868 100644 --- a/daggerverse/gale/workflow_run.go +++ b/daggerverse/gale/workflow_run.go @@ -13,6 +13,9 @@ type WorkflowRun struct { // WorkflowRunConfig holds the configuration of a workflow run. type WorkflowRunConfig struct { + // Base container to use for the workflow run. + Base *Container + // Directory containing the repository source. Source *Directory @@ -43,9 +46,6 @@ type WorkflowRunConfig struct { // File with the complete webhook event payload. EventFile *File - // Image to use for the runner. - RunnerImage string - // Enables debug mode. RunnerDebug bool @@ -159,7 +159,7 @@ func (wr *WorkflowRun) run(ctx context.Context) (*Container, error) { } func (wr *WorkflowRun) container(ctx context.Context) (*Container, error) { - container := dag.Container().From(wr.Config.RunnerImage) + container := wr.Config.Base // set github token as secret if provided if wr.Config.Token != nil { diff --git a/daggerverse/gale/workflows.go b/daggerverse/gale/workflows.go deleted file mode 100644 index 07d60de7..00000000 --- a/daggerverse/gale/workflows.go +++ /dev/null @@ -1,128 +0,0 @@ -package main - -import ( - "context" - "fmt" - "path/filepath" - "strings" -) - -type Workflows struct{} - -func (w *Workflows) List( - ctx context.Context, - // The directory containing the repository source. If source is provided, rest of the options are ignored. - source Optional[*Directory], - // The name of the repository. Format: owner/name. - repo Optional[string], - // Tag name to check out. Only one of branch or tag can be used. Precedence is as follows: tag, branch. - tag Optional[string], - // Branch name to check out. Only one of branch or tag can be used. Precedence is as follows: tag, branch. - branch Optional[string], - // Path to the workflows' directory. (default: .github/workflows) - workflowsDir Optional[string], -) (string, error) { - // convert workflows list options to repo source options - opts := RepoInfoOpts{ - Source: source.GetOr(nil), - Repo: repo.GetOr(""), - Tag: tag.GetOr(""), - Branch: branch.GetOr(""), - } - - // get the repository source working directory from the options -- default value handled by the repo module, so we - // don't need to handle it here. - dir := dag.Repo().Info(opts).WorkflowsDir(RepoInfoWorkflowsDirOpts{WorkflowsDir: workflowsDir.GetOr("")}) - - // list all entries in the workflows directory - entries, err := dir.Entries(ctx) - if err != nil { - return "", err - } - - sb := strings.Builder{} - - for _, entry := range entries { - // load only .yaml and .yml files - if strings.HasSuffix(entry, ".yaml") || strings.HasSuffix(entry, ".yml") { - file := dir.File(entry) - path := filepath.Join(workflowsDir.GetOr(".github/workflows"), entry) - - // dagger do not support maps yet, so we're defining anonymous struct to unmarshal the yaml file to avoid - // hit this limitation. - - var workflow struct { - Name string `yaml:"name"` - Jobs map[string]interface{} `yaml:"jobs"` - } - - if err := unmarshalContentsToYAML(ctx, file, &workflow); err != nil { - return "", err - } - - sb.WriteString("Workflow: ") - if workflow.Name != "" { - sb.WriteString(fmt.Sprintf("%s (path: %s)\n", workflow.Name, path)) - } else { - sb.WriteString(fmt.Sprintf("%s\n", path)) - } - - sb.WriteString("Jobs:\n") - - for job := range workflow.Jobs { - sb.WriteString(fmt.Sprintf(" - %s\n", job)) - } - - sb.WriteString("\n") // extra empty line - } - } - - return sb.String(), nil -} - -func (w *Workflows) Run( - // The directory containing the repository source. If source is provided, rest of the options are ignored. - source Optional[*Directory], - // The name of the repository. Format: owner/name. - repo Optional[string], - // Tag name to check out. Only one of branch or tag can be used. Precedence is as follows: tag, branch. - tag Optional[string], - // Branch name to check out. Only one of branch or tag can be used. Precedence is as follows: tag, branch. - branch Optional[string], - // Path to the workflows directory. (default: .github/workflows) - workflowsDir Optional[string], - // External workflow file to run. - workflowFile Optional[*File], - // Name of the workflow to run. - workflow Optional[string], - // Name of the job to run. If empty, all jobs will be run. - job Optional[string], - // Name of the event that triggered the workflow. e.g. push - event Optional[string], - // File with the complete webhook event payload. - eventFile Optional[*File], - // Image to use for the runner. - runnerImage Optional[string], - // Enables debug mode. - runnerDebug Optional[bool], - // GitHub token to use for authentication. - token Optional[*Secret], -) *WorkflowRun { - return &WorkflowRun{ - Config: WorkflowRunConfig{ - Source: source.GetOr(nil), - Repo: repo.GetOr(""), - Branch: branch.GetOr(""), - Tag: tag.GetOr(""), - WorkflowsDir: workflowsDir.GetOr(".github/workflows"), - WorkflowFile: workflowFile.GetOr(nil), - Workflow: workflow.GetOr(""), - Job: job.GetOr(""), - Event: event.GetOr("push"), - EventFile: eventFile.GetOr(nil), - RunnerImage: runnerImage.GetOr("ghcr.io/catthehacker/ubuntu:act-latest"), - RunnerDebug: runnerDebug.GetOr(false), - Token: token.GetOr(nil), - }, - } -}