Skip to content

Commit 07f175f

Browse files
authored
fix incorrect commentId being passed to spec for commentops (#1617)
1 parent 61d7552 commit 07f175f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

backend/controllers/github.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ func handleIssueCommentEvent(gh utils.GithubClientProvider, payload *github.Issu
748748
cloneURL := *payload.Repo.CloneURL
749749
issueNumber := *payload.Issue.Number
750750
isDraft := payload.Issue.GetDraft()
751-
commentId := *payload.GetComment().ID
751+
userCommentId := *payload.GetComment().ID
752752
actor := *payload.Sender.Login
753753
commentBody := *payload.Comment.Body
754754
defaultBranch := *payload.Repo.DefaultBranch
@@ -782,7 +782,7 @@ func handleIssueCommentEvent(gh utils.GithubClientProvider, payload *github.Issu
782782
return fmt.Errorf("error getting digger config")
783783
}
784784

785-
commentIdStr := strconv.FormatInt(commentId, 10)
785+
commentIdStr := strconv.FormatInt(userCommentId, 10)
786786
err = ghService.CreateCommentReaction(commentIdStr, string(dg_github.GithubCommentEyesReaction))
787787
if err != nil {
788788
log.Printf("CreateCommentReaction error: %v", err)
@@ -888,7 +888,13 @@ func handleIssueCommentEvent(gh utils.GithubClientProvider, payload *github.Issu
888888
impactedProjectsJobMap[j.ProjectName] = j
889889
}
890890

891-
batchId, _, err := utils.ConvertJobsToDiggerJobs(*diggerCommand, "github", orgId, impactedProjectsJobMap, impactedProjectsMap, projectsGraph, installationId, *branch, issueNumber, repoOwner, repoName, repoFullName, *commitSha, commentId, diggerYmlStr, 0)
891+
reporterCommentId, err := strconv.ParseInt(commentReporter.CommentId, 10, 64)
892+
if err != nil {
893+
log.Printf("strconv.ParseInt error: %v", err)
894+
utils.InitCommentReporter(ghService, issueNumber, fmt.Sprintf(":x: could not handle commentId: %v", err))
895+
}
896+
897+
batchId, _, err := utils.ConvertJobsToDiggerJobs(*diggerCommand, "github", orgId, impactedProjectsJobMap, impactedProjectsMap, projectsGraph, installationId, *branch, issueNumber, repoOwner, repoName, repoFullName, *commitSha, reporterCommentId, diggerYmlStr, 0)
892898
if err != nil {
893899
log.Printf("ConvertJobsToDiggerJobs error: %v", err)
894900
utils.InitCommentReporter(ghService, issueNumber, fmt.Sprintf(":x: ConvertJobsToDiggerJobs error: %v", err))

0 commit comments

Comments
 (0)