Skip to content

Commit

Permalink
feat: 🔧 warning log when cloning wiki fails
Browse files Browse the repository at this point in the history
Scenarios where wiki is enabled in repository settings but no wiki is created leads to failure and stops the backup process. Instead log as warning with instructions to disable wiki from repository settings if not required.
  • Loading branch information
AkashRajpurohit committed Aug 15, 2024
1 parent b8c9d17 commit a095e7d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/sync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@ func SyncWiki(repoOwner, repoName string, config config.Config) {

cmd := exec.Command("git", "clone", repoWikiURL, repoWikiPath)
if err := cmd.Run(); err != nil {
logger.Fatalf("Error cloning wiki %s: %v\n", repoFullName, err)
// Do not fail if wiki does not exist, it can be possible that the repo does not have a wiki
// but in the repository settings wiki have been enabled
// Log as warning instead of error, so that it does not fail the whole process
logger.Warnf("Error cloning wiki %s: %v\n", repoFullName, err)
logger.Warnf("It is possible that the repository %s does not have a wiki created. In such case, go to your repository settings and disable the wiki if its not being used.", repoFullName)
} else {
logger.Info("Cloned wiki: ", repoFullName)
}
Expand All @@ -65,7 +69,7 @@ func SyncWiki(repoOwner, repoName string, config config.Config) {

cmd := exec.Command("git", "-C", repoWikiPath, "pull", "--prune", "origin")
if err := cmd.Run(); err != nil {
logger.Fatalf("Error updating wiki %s: %v\n", repoFullName, err)
logger.Warnf("Error updating wiki %s: %v\n", repoFullName, err)
} else {
logger.Info("Updated wiki: ", repoFullName)
}
Expand Down

0 comments on commit a095e7d

Please sign in to comment.