Skip to content

Commit

Permalink
gitlab: if someone is assigned as reviewer the eyes are displayed in …
Browse files Browse the repository at this point in the history
…slack
  • Loading branch information
Carlotta Fabian committed Dec 18, 2024
1 parent 695f663 commit 0b81efa
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions command/pullrequest/gitlab.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package pullrequest

import (
"regexp"
"strings"
"text/template"

"github.com/innogames/slack-bot/v2/bot"
"github.com/innogames/slack-bot/v2/bot/config"
"github.com/innogames/slack-bot/v2/bot/matcher"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"github.com/xanzy/go-gitlab"
"gitlab.com/gitlab-org/api/client-go"
"regexp"
"strings"
"text/template"
)

type gitlabFetcher struct {
Expand Down Expand Up @@ -63,11 +62,17 @@ func (c *gitlabFetcher) getPullRequest(match matcher.Result) (pullRequest, error

func (c *gitlabFetcher) getStatus(pr *gitlab.MergeRequest) prStatus {
// https://docs.gitlab.com/ce/api/merge_requests.html
switch pr.State {
case "merged":
var inReview = false
if len(pr.Reviewers) > 0 {
inReview = true
}
switch {
case pr.State == "merged":
return prStatusMerged
case "closed", "locked":
case pr.State == "closed" || pr.State == "locked":
return prStatusClosed
case inReview:
return prStatusInReview
default:
return prStatusOpen
}
Expand Down

0 comments on commit 0b81efa

Please sign in to comment.