diff options
author | earl-warren <earl-warren@noreply.code.forgejo.org> | 2024-05-25 00:44:22 +0200 |
---|---|---|
committer | earl-warren <earl-warren@noreply.code.forgejo.org> | 2024-05-25 00:44:22 +0200 |
commit | 1b956897953f4a9b5fb67e05d572473256784633 (patch) | |
tree | ee9295b3621dc8896a631f705e7fb0d5c8e61f01 | |
parent | Merge pull request 'README: explain how end-to-end tests help with reporting ... (diff) | |
parent | Add support for workflow inputs (diff) | |
download | forgejo-runner-1b956897953f4a9b5fb67e05d572473256784633.tar.xz forgejo-runner-1b956897953f4a9b5fb67e05d572473256784633.zip |
Merge pull request 'Add support for workflow inputs' (#199) from Mai-Lapyst/runner:support-workflow-inputs into main
Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/199
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
-rw-r--r-- | internal/app/run/runner.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/app/run/runner.go b/internal/app/run/runner.go index ff54fa7..69001d1 100644 --- a/internal/app/run/runner.go +++ b/internal/app/run/runner.go @@ -187,6 +187,13 @@ func (r *Runner) run(ctx context.Context, task *runnerv1.Task, reporter *report. maxLifetime = time.Until(deadline) } + var inputs map[string]string + if preset.EventName == "workflow_dispatch" { + if inputsRaw, ok := preset.Event["inputs"]; ok { + inputs, _ = inputsRaw.(map[string]string) + } + } + runnerConfig := &runner.Config{ // On Linux, Workdir will be like "/<parent_directory>/<owner>/<repo>" // On Windows, Workdir will be like "\<parent_directory>\<owner>\<repo>" @@ -218,6 +225,7 @@ func (r *Runner) run(ctx context.Context, task *runnerv1.Task, reporter *report. Vars: task.Vars, ValidVolumes: r.cfg.Container.ValidVolumes, InsecureSkipTLS: r.cfg.Runner.Insecure, + Inputs: inputs, } rr, err := runner.New(runnerConfig) |