Skip to content

Commit

Permalink
chore: send rr.author.id id of github and gitlab.
Browse files Browse the repository at this point in the history
Signed-off-by: i4k <[email protected]>
  • Loading branch information
i4ki committed Dec 20, 2024
1 parent fcdfa52 commit 7543a08
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions cmd/terramate/cli/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()
}
Expand Down Expand Up @@ -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(),
})
Expand Down Expand Up @@ -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,
},
Expand All @@ -1499,6 +1506,9 @@ func (c *cli) newGitlabReviewRequest(mr gitlab.MR) *cloud.ReviewRequest {
Name: l,
})
}

// TODO(i4k): implement reviewers for Gitlab

return rr
}

Expand Down

0 comments on commit 7543a08

Please sign in to comment.