From 4661069db3ad9a8091ae7d65c653a32de87254e3 Mon Sep 17 00:00:00 2001 From: Ali AKCA Date: Thu, 26 Oct 2023 13:10:03 +0200 Subject: [PATCH] refactor: replace `result` command with `sync` --- README.md | 6 +++--- daggerverse/gale/workflow_run.go | 15 ++++----------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 33c4dca..86efedd 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ the help output showing the usage and options: Available Commands: config Configuration for the workflow run. directory Directory returns the directory of the workflow run information. - result Result returns executes the workflow run and returns the result. + 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. @@ -110,10 +110,10 @@ the help output showing the usage and options: #### Sub-Commands -- **result**: Returns the summary of the workflow run. +- **sync**: Sync evaluates the workflow run and returns the container at executed the workflow. ```shell -dagger call workflow run ... --workflow build results +dagger call workflow run ... --workflow build sync ``` - **directory**: Exports workflow run data. diff --git a/daggerverse/gale/workflow_run.go b/daggerverse/gale/workflow_run.go index 2c05fa9..700a599 100644 --- a/daggerverse/gale/workflow_run.go +++ b/daggerverse/gale/workflow_run.go @@ -12,21 +12,14 @@ type WorkflowRun struct { Config WorkflowRunConfig } -// Result returns executes the workflow run and returns the result. -func (wr *WorkflowRun) Result(ctx context.Context) (string, error) { +// Sync evaluates the workflow run and returns the container that executed the workflow. +func (wr *WorkflowRun) Sync(ctx context.Context) (*Container, error) { container, err := wr.run(ctx) if err != nil { - return "", err - } - - var result WorkflowRunReport - - err = container.File("/home/runner/_temp/ghx/run/workflow_run.json").unmarshalContentsToJSON(ctx, &result) - if err != nil { - return "", err + return nil, err } - return fmt.Sprintf("Workflow %s completed with conclusion %s in %s", result.Name, result.Conclusion, result.Duration), nil + return container.Sync(ctx) } // Directory returns the directory of the workflow run information.