Skip to content

Commit

Permalink
feat: add milestone set check
Browse files Browse the repository at this point in the history
  • Loading branch information
lukashass committed Feb 8, 2024
1 parent f1bb576 commit d876e55
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions plugins/auto_merge/checks/has_milestone.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package checks

import (
"github.com/GEPROG/lassie-bot-dog/plugins/auto_merge/config"
"github.com/xanzy/go-gitlab"
)

type HasMilestone struct {
}

func (check HasMilestone) Check(_ *config.AutoMergeConfig, _ *gitlab.Project, mergeRequest *gitlab.MergeRequest) bool {
return mergeRequest.Milestone != nil
}

func (check HasMilestone) Name() string {
return "has-milestone"
}

func (check HasMilestone) PassedText(_ int) string {
return "Your Merge-Request has a milestone assigned"
}

func (check HasMilestone) FailedText(_ int) string {
return "Your Merge-Request has no milestone assigned"
}
1 change: 1 addition & 0 deletions plugins/auto_merge/merge_checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func (plugin AutoMergePlugin) setupMergeChecks() {
checks.HasNoOpenDiscussionsCheck{Client: plugin.Client},
checks.IsNotWorkInProgressCheck{},
checks.HasAssignee{},
checks.HasMilestone{},
checks.PassesCICheck{
Client: plugin.Client,
},
Expand Down

0 comments on commit d876e55

Please sign in to comment.