Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Commit

Permalink
Fix bug in issue and pr number (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
micnncim authored Oct 16, 2019
1 parent a82fea0 commit 0fc44c9
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions cmd/action-lgtm-reaction/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,21 @@ func main() {
}

if needCreateComment {
number, err := strconv.Atoi(githubIssueNumber)
if err != nil {
exit("unable to convert string to int in issue number: %v\n", err)
if githubIssueNumber == "" && githubPullRequestNumber == "" {
exit("no issue number and pull request number\n")
}
var number int
var err error
if githubIssueNumber != "" {
number, err = strconv.Atoi(githubIssueNumber)
if err != nil {
exit("unable to convert string to int in issue number: %v\n", err)
}
} else if githubPullRequestNumber != "" {
number, err = strconv.Atoi(githubPullRequestNumber)
if err != nil {
exit("unable to convert string to int in pull request number: %v\n", err)
}
}
if err := githubClient.CreateIssueComment(ctx, owner, repo, number, comment); err != nil {
exit("unable to create issue comment: %v\n", err)
Expand Down

0 comments on commit 0fc44c9

Please sign in to comment.