fix: if RequestedReviewers or Labels are empty, add dummy nil

This commit is contained in:
Derrick Hammer 2024-02-11 05:22:35 -05:00
parent 7cfcbad86d
commit bf74d45404
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 8 additions and 0 deletions

View File

@ -6,6 +6,14 @@ import (
) )
func convertPullRequestEvent(event *structs.PullRequestPayload) *github.PullRequestEvent { func convertPullRequestEvent(event *structs.PullRequestPayload) *github.PullRequestEvent {
if len(event.PullRequest.RequestedReviewers) == 0 {
event.PullRequest.RequestedReviewers = append(event.PullRequest.RequestedReviewers, nil)
}
if len(event.PullRequest.Labels) == 0 {
event.PullRequest.Labels = append(event.PullRequest.Labels, nil)
}
return &github.PullRequestEvent{ return &github.PullRequestEvent{
Action: stringPtr(translatePrAction(event.Action)), Action: stringPtr(translatePrAction(event.Action)),
PullRequest: convertPullRequest(event.PullRequest), PullRequest: convertPullRequest(event.PullRequest),