Skip to content

Commit

Permalink
Add send message when validate failed (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
na-ga authored Jan 5, 2022
1 parent 3f17d70 commit 6564f52
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,15 @@ func main() {
if err != nil {
log.Fatal(err.Error())
}
if err := validateEnv(e); err != nil {
log.Fatal(err.Error())
}
ctx, f := context.WithTimeout(context.Background(), jobTimeout)
defer f()
client := newGHClient(e.GithubToken)
if err := validateEnv(e); err != nil {
if serr := client.sendMsg(ctx, e.Owner, e.Repo, e.PRNumber, errMsg(err)); serr != nil {
log.Fatalf("failed to send message: %v original: %v", serr, err)
}
log.Fatal(err.Error())
}
if err := client.merge(ctx, e.Owner, e.Repo, e.PRNumber, e.MergeMethod); err != nil {
if serr := client.sendMsg(ctx, e.Owner, e.Repo, e.PRNumber, errMsg(err)); serr != nil {
log.Fatalf("failed to send message: %v original: %v", serr, err)
Expand Down

0 comments on commit 6564f52

Please sign in to comment.