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

feat: add fetch repository if it not already exist in db #530

Merged
Merged
Changes from 1 commit
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
12 changes: 12 additions & 0 deletions internal/dvserver/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ func (s *service) Graph(ctx context.Context, in *Graph_Input) (*Graph_Output, er
if err != nil {
return nil, fmt.Errorf("load tasks: %w", err)
}

// fetch if not already in db
if len(tasks) == 0 {
_, err := dvcore.PullAndSave(filters.Targets, s.h, s.schema, s.opts.GitHubToken, false, s.opts.Logger)
if err != nil {
return nil, fmt.Errorf("pull: %w", err)
}
tasks, err = dvstore.LoadTasks(s.h, s.schema, filters, s.opts.Logger)
if err != nil {
return nil, fmt.Errorf("load tasks: %w", err)
}
}

// build output
ret := Graph_Output{
Expand Down