Skip to content

Commit

Permalink
Exit with error status code when plan preview failed
Browse files Browse the repository at this point in the history
Signed-off-by: Takumaron <[email protected]>
  • Loading branch information
TakumaKurosawa committed Nov 8, 2023
1 parent 89fb203 commit 75c3f40
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tool/actions-plan-preview/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ func main() {

if event.PRClosed {
doComment(failureBadgeURL + "Unable to run plan-preview for a closed pull request.")
return
log.Fatal("failed to run plan-preview for a closed pull request")
}

// TODO: When PR opened, `Mergeable` is nil for calculation.
// Here it is not considered for now, but needs to be handled.
if event.PRMergeable != nil && *event.PRMergeable == false {
doComment(failureBadgeURL + "Unable to run plan-preview for an un-mergeable pull request. Please resolve the conficts and try again.")
return
log.Fatal("failed to run plan-preview for an un-mergeable pull request.")
}

result, err := retrievePlanPreview(
Expand All @@ -135,7 +135,7 @@ func main() {
}
if !pr.GetClosedAt().IsZero() {
doComment(failureBadgeURL + "Unable to run plan-preview for a closed pull request.")
return
log.Fatal("failed to run plan-preview for a closed pull request.")
}
}

Expand Down

0 comments on commit 75c3f40

Please sign in to comment.