Skip to content

Commit

Permalink
Moved file function to break before approval
Browse files Browse the repository at this point in the history
This fixes the issue of a approval being sent on file error.

Signed-off-by: Lucas Zampieri <lzampier@redhat.com>
  • Loading branch information
zampierilucas committed Aug 26, 2021
1 parent 653549a commit 4c80927
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions cmd/mr_approve.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ var mrApproveCmd = &cobra.Command{
log.Fatal(err)
}

if comment || len(msgs) > 0 || filename != "" {
linebreak, err := cmd.Flags().GetBool("force-linebreak")
if err != nil {
log.Fatal(err)
}

createNote(rn, true, int(id), msgs, filename, linebreak, "")
}

err = lab.MRApprove(p.ID, int(id))
if err != nil {
if err == lab.ErrStatusForbidden {
Expand All @@ -59,15 +68,6 @@ var mrApproveCmd = &cobra.Command{
}
}

if comment || len(msgs) > 0 || filename != "" {
linebreak, err := cmd.Flags().GetBool("force-linebreak")
if err != nil {
log.Fatal(err)
}

createNote(rn, true, int(id), msgs, filename, linebreak, "")
}

fmt.Printf("Merge Request !%d approved\n", id)
},
}
Expand Down

0 comments on commit 4c80927

Please sign in to comment.