Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: replace result command with sync #153

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading