|
|
@ -95,13 +95,10 @@ func (run *ActionRun) LoadAttributes(ctx context.Context) error { |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if run.Repo == nil { |
|
|
|
if err := run.LoadRepo(ctx); err != nil { |
|
|
|
repo, err := repo_model.GetRepositoryByID(ctx, run.RepoID) |
|
|
|
return err |
|
|
|
if err != nil { |
|
|
|
|
|
|
|
return err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
run.Repo = repo |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if err := run.Repo.LoadAttributes(ctx); err != nil { |
|
|
|
if err := run.Repo.LoadAttributes(ctx); err != nil { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
@ -117,6 +114,19 @@ func (run *ActionRun) LoadAttributes(ctx context.Context) error { |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (run *ActionRun) LoadRepo(ctx context.Context) error { |
|
|
|
|
|
|
|
if run == nil || run.Repo != nil { |
|
|
|
|
|
|
|
return nil |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
repo, err := repo_model.GetRepositoryByID(ctx, run.RepoID) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
return err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
run.Repo = repo |
|
|
|
|
|
|
|
return nil |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func (run *ActionRun) Duration() time.Duration { |
|
|
|
func (run *ActionRun) Duration() time.Duration { |
|
|
|
return calculateDuration(run.Started, run.Stopped, run.Status) |
|
|
|
return calculateDuration(run.Started, run.Stopped, run.Status) |
|
|
|
} |
|
|
|
} |
|
|
|