Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Dangerfile « assignees « danger - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 611ad76d3f0f752a9ec3371f06ddd7d129f815b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

def link_reviewer(name)
  "[`@#{name}`](https://gitlab.com/dashboard/merge_requests?assignee_username=#{name}&not[author_username]=#{name})"
end

if gitlab.mr_json['assignees'].none?
  warn <<~TXT
    This merge request does not have any assignee yet. Setting an assignee
    clarifies who needs to take action on the merge request at any given time.
  TXT
end

suggestions = (REVIEWERS - [gitlab.mr_author]).sample(2, random: Random.new(gitlab.mr_json['iid']))

case suggestions.size
when 0
when 1
  message "Suggested maintainer: #{link_reviewer(suggestions.first)}"
else
  message "Suggested maintainers: #{link_reviewer(suggestions.first)}, and #{link_reviewer(suggestions.last)}"
end

# vim: ft=ruby