Skip to content
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
7 changes: 5 additions & 2 deletions cmd/digger/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,11 @@ func gitHubCI(lock core_locking.Lock) {
CiService: githubPrService,
PrNumber: prNumber,
}

allAppliesSuccessful, atLeastOneApply, err := digger.RunCommandsPerProject(commandsToRunPerProject, parsedGhContext.Repository, githubActor, eventName, prNumber, githubPrService, lock, reporter, planStorage, "")
currentDir, err := os.Getwd()
if err != nil {
reportErrorAndExit(githubActor, fmt.Sprintf("Failed to get current dir. %s", err), 4)
}
allAppliesSuccessful, atLeastOneApply, err := digger.RunCommandsPerProject(commandsToRunPerProject, parsedGhContext.Repository, githubActor, eventName, prNumber, githubPrService, lock, reporter, planStorage, currentDir)
if err != nil {
reportErrorAndExit(githubActor, fmt.Sprintf("Failed to run commands. %s", err), 8)
}
Expand Down
19 changes: 19 additions & 0 deletions pkg/configuration/digger_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,24 @@ func GetFilesWithExtension(workingDir string, ext string) ([]string, error) {
return files, nil
}

func GetFilesWithExtension(workingDir string, ext string) ([]string, error) {
var files []string
listOfFiles, err := os.ReadDir(workingDir)
if err != nil {
return nil, errors.New(fmt.Sprintf("error reading directory %s: %v", workingDir, err))
}
for _, f := range listOfFiles {
if !f.IsDir() {
r, err := regexp.MatchString(ext, f.Name())
if err == nil && r {
files = append(files, f.Name())
}
}
}

return files, nil
}

func (walker *FileSystemDirWalker) GetDirs(workingDir string) ([]string, error) {
var dirs []string
err := filepath.Walk(workingDir,
Expand All @@ -61,6 +79,7 @@ func (walker *FileSystemDirWalker) GetDirs(workingDir string) ([]string, error)

var ErrDiggerConfigConflict = errors.New("more than one digger config file detected, please keep either 'digger.yml' or 'digger.yaml'")


func LoadDiggerConfig(workingDir string, walker DirWalker) (*DiggerConfig, error) {
configYaml := &DiggerConfigYaml{}
config := &DiggerConfig{}
Expand Down