From 7543a08d1749347e75d493235dd5fd11e4a471c9 Mon Sep 17 00:00:00 2001 From: i4k Date: Fri, 20 Dec 2024 09:35:41 +0000 Subject: [PATCH] chore: send rr.author.id id of github and gitlab. Signed-off-by: i4k --- cmd/terramate/cli/cloud.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cmd/terramate/cli/cloud.go b/cmd/terramate/cli/cloud.go index 474bb7277..d72cee9a1 100644 --- a/cmd/terramate/cli/cloud.go +++ b/cmd/terramate/cli/cloud.go @@ -1104,8 +1104,8 @@ func (c *cli) newBitbucketReviewRequest(pr *bitbucket.PR) *cloud.ReviewRequest { UpdatedAt: &updatedAt, Status: pr.State, Author: cloud.Author{ - Login: pr.Author.DisplayName, ID: pr.Author.UUID, + Login: pr.Author.DisplayName, AvatarURL: avatarURL, }, Branch: c.cloud.run.metadata.BitbucketPipelinesBranch, @@ -1383,6 +1383,7 @@ func (c *cli) newGithubReviewRequest( ) *cloud.ReviewRequest { author := cloud.Author{} if user := pull.GetUser(); user != nil { + author.ID = strconv.Itoa64(int64(user.GetID())) author.Login = user.GetLogin() author.AvatarURL = user.GetAvatarURL() } @@ -1433,14 +1434,19 @@ func (c *cli) newGithubReviewRequest( rr.ApprovedCount++ } - login := review.GetUser().GetLogin() + user := review.GetUser() + if user == nil { + continue + } + login := user.GetLogin() if _, found := uniqueReviewers[login]; found { continue } uniqueReviewers[login] = struct{}{} rr.Reviewers = append(rr.Reviewers, cloud.Reviewer{ + ID: strconv.Itoa64(user.GetID()), Login: login, AvatarURL: review.GetUser().GetAvatarURL(), }) @@ -1486,6 +1492,7 @@ func (c *cli) newGitlabReviewRequest(mr gitlab.MR) *cloud.ReviewRequest { UpdatedAt: &mrUpdatedAt, Status: mr.State, Author: cloud.Author{ + ID: strconv.Itoa64(int64(mr.Author.ID)), Login: mr.Author.Username, AvatarURL: mr.Author.AvatarURL, }, @@ -1499,6 +1506,9 @@ func (c *cli) newGitlabReviewRequest(mr gitlab.MR) *cloud.ReviewRequest { Name: l, }) } + + // TODO(i4k): implement reviewers for Gitlab + return rr }