feature/query-results (#12)

Co-authored-by: kjuulh <contact@kjuulh.io>
Reviewed-on: kjuulh/kraken#12
This commit is contained in:
2022-09-18 16:11:22 +02:00
parent fa8985a0e7
commit 3ef688a00d
7 changed files with 172 additions and 9 deletions

View File

@@ -112,17 +112,32 @@ func (pr *ProcessRepos) processRepo(ctx context.Context, repoUrl string, action
return err
}
err = action.Execute(ctx, area)
if err != nil {
return err
if len(action.Schema.Queries) > 0 {
result, found, err := action.Query(ctx, area)
if err != nil {
return err
}
if found {
pr.logger.Info("Query result", zap.Strings("result", result))
// TODO: Append to real result, and return together
}
}
err = pr.commit(ctx, area, repo, repoUrl)
if err != nil {
return err
if len(action.Schema.Actions) > 0 {
err = action.Execute(ctx, area)
if err != nil {
return err
}
err = pr.commit(ctx, area, repo, repoUrl)
if err != nil {
return err
}
}
pr.logger.Debug("processing done", zap.String("path", area.Path), zap.String("repoUrl", repoUrl))
return nil
}