Skip to content

Commit

Permalink
refactor: replace result command with sync
Browse files Browse the repository at this point in the history
  • Loading branch information
aweris committed Oct 26, 2023
1 parent c3ef16d commit 4661069
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
15 changes: 4 additions & 11 deletions daggerverse/gale/workflow_run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 4661069

Please sign in to comment.