Skip to content

Commit

Permalink
Add more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
kaypee90 committed Jul 23, 2024
1 parent e23669e commit 6e655fa
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions cmd/depbot/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,6 @@ func createDirIfItDoesNotExit(dir string) (hasCreatedNewDir bool, err error) {
return false, nil
}

func getCurrentDir() string {
currentDir, err := os.Getwd()
if err != nil {
panic(err)
}

return filepath.Base(currentDir)
}

func writeDataToFile(fileName string, data []byte) {
file, err := os.Create(fileName)
if err != nil {
Expand All @@ -61,14 +52,25 @@ func createConfigurationFile(fileName string, destinationDir string, data []byte
fullFilePath := fileName

if !skipCreatingDir {

log.Printf("Creating %s directory..", githubDir)
createDirIfItDoesNotExit(destinationDir)
fullFilePath = destinationDir + "/" + fileName
} else {
log.Printf("Skipping directory creation since current directory is %s", githubDir)
}

writeDataToFile(fullFilePath, data)
}

func getCurrentDir() string {
currentDir, err := os.Getwd()
if err != nil {
panic(err)
}

return filepath.Base(currentDir)
}

func createDependabotYmlFile(data []byte) {
skipCreatingDir := getCurrentDir() == githubDir
createConfigurationFile(dependabotFileName, githubDir, data, skipCreatingDir)
Expand Down

0 comments on commit 6e655fa

Please sign in to comment.