with actions repo

This commit is contained in:
2022-09-14 21:57:14 +02:00
parent ce55f6523c
commit e40e7cc88b
6 changed files with 55 additions and 34 deletions

View File

@@ -47,18 +47,13 @@ func (ac *ActionCreator) Prepare(ctx context.Context, ops *ActionCreatorOps) (*A
return nil, err
}
cloneCtx, _ := context.WithTimeout(ctx, time.Second*5)
repo, err := ac.git.Clone(cloneCtx, area, ops.RepositoryUrl)
cloneCtx, _ := context.WithTimeout(ctx, time.Second*10)
_, err = ac.git.CloneBranch(cloneCtx, area, ops.RepositoryUrl, ops.Branch)
if err != nil {
ac.logger.Error("could not clone repo", zap.Error(err))
return nil, err
}
err = ac.git.Checkout(ctx, repo, ops.Branch)
if err != nil {
return nil, err
}
executorUrl := path.Join(area.Path, ops.Path)
if _, err = os.Stat(executorUrl); os.IsNotExist(err) {
return nil, fmt.Errorf("path is invalid: %s", ops.Path)
@@ -74,6 +69,8 @@ func (ac *ActionCreator) Prepare(ctx context.Context, ops *ActionCreatorOps) (*A
return nil, err
}
ac.logger.Debug("Action creator done")
return &Action{
Schema: krakenSchema,
}, nil