Skip to content

Commit

Permalink
fix(merge): Do not fail on backup errors
Browse files Browse the repository at this point in the history
Signed-off-by: Cezar Craciunoiu <[email protected]>
  • Loading branch information
craciunoiuc committed Jan 9, 2024
1 parent f88b875 commit dd6bc39
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/governctl/pr/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,13 @@ func (opts *Merge) Run(ctx context.Context, args []string) error {
cmd = exec.Command("gh", "auth", "token")
cmd.Stderr = log.G(ctx).WriterLevel(logrus.ErrorLevel)
if output, err = cmd.Output(); err != nil {
return fmt.Errorf("could not backup token: %w", err)
log.G(ctx).Warn("no token to back up, skipping")
token = ""
} else {
token = string(output)
}
token = string(output)

if strings.HasPrefix(token, "no oauth token found") {
token = ""
} else if !strings.HasPrefix(token, "gh") {
if token != "" && !strings.HasPrefix(token, "gh") {
return fmt.Errorf("could not backup token, invalid format (try running `gh auth token` manually): %w", err)
}

Expand Down

0 comments on commit dd6bc39

Please sign in to comment.