Skip to content

Commit

Permalink
fix relative path for issues (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
cooperspencer authored Dec 4, 2023
1 parent ccb0c58 commit a78d73f
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,24 @@ func Locally(repo types.Repo, l types.Local, dry bool) bool {
Msg(err.Error())
}
}
sub.Info().Str("repo", repo.Name).Msg("backing up issues")
if !dry {
for k, v := range repo.Issues {
jsonData, err := json.Marshal(v)
if err != nil {
sub.Error().
Msg(err.Error())
} else {
err = os.WriteFile(filepath.Join(l.Path, fmt.Sprintf("%s.issues", repo.Name), fmt.Sprintf("%s.json", k)), jsonData, 0644)
issuesDir, err := filepath.Abs(fmt.Sprintf("%s.issues", repo.Name))
if err != nil {
sub.Error().
Msg(err.Error())
} else {
sub.Info().Str("repo", repo.Name).Msg("backing up issues")
if !dry {
for k, v := range repo.Issues {
jsonData, err := json.Marshal(v)
if err != nil {
sub.Error().
Msg(err.Error())
} else {
err = os.WriteFile(filepath.Join(issuesDir, fmt.Sprintf("%s.json", k)), jsonData, 0644)
if err != nil {
sub.Error().
Msg(err.Error())
}
}
}
}
Expand Down

0 comments on commit a78d73f

Please sign in to comment.