debian-mirror-gitlab/danger/gitlab_ui_wg/Dangerfile

63 lines
2 KiB
Ruby
Raw Normal View History

2019-09-04 21:01:54 +05:30
FRONTEND_MAINTAINERS = %w[filipa iamphill psimyn sarahghp mishunov].freeze
UX_MAINTAINERS = %w[tauriedavis rverissimo].freeze
NO_REVIEWER = 'No reviewer available'.freeze
2019-07-07 11:18:12 +05:30
def mention_single_codebase_approvers
2019-09-04 21:01:54 +05:30
canonical_branch_name =
roulette.canonical_branch_name(gitlab.mr_json['source_branch'])
random = roulette.new_random(canonical_branch_name)
frontend_maintainers = helper.new_teammates(FRONTEND_MAINTAINERS)
ux_maintainers = helper.new_teammates(UX_MAINTAINERS)
2019-07-07 11:18:12 +05:30
rows = []
if gitlab.mr_labels.include?('frontend')
2019-09-04 21:01:54 +05:30
frontend_maintainer =
roulette.spin_for_person(frontend_maintainers, random: random)
2019-07-07 11:18:12 +05:30
2019-09-04 21:01:54 +05:30
rows << "| ~frontend | #{frontend_maintainer&.markdown_name || NO_REVIEWER}"
2019-07-07 11:18:12 +05:30
end
if gitlab.mr_labels.include?('UX')
2019-09-04 21:01:54 +05:30
ux_maintainers =
roulette.spin_for_person(ux_maintainers, random: random)
2019-07-07 11:18:12 +05:30
2019-09-04 21:01:54 +05:30
rows << "| ~UX | #{ux_maintainers&.markdown_name || NO_REVIEWER}"
2019-07-07 11:18:12 +05:30
end
if rows.empty?
backup_maintainer = frontend_maintainers.sample
2019-09-04 21:01:54 +05:30
rows << "| ~frontend / ~UX | #{backup_maintainer.markdown_name}"
2019-07-07 11:18:12 +05:30
end
markdown(<<~MARKDOWN.strip)
## GitLab UI Working Group changes
This merge request contains changes related to the work of [cleaning up CSS and creating
reusable components](https://gitlab.com/groups/gitlab-org/-/epics/950).
These changes will need to be reviewed and approved by the following engineers:
| Category | Reviewer
|----------|---------
#{rows.join("\n")}
To make sure this happens, please follow these steps:
1. Add all of the mentioned users to the list of merge request approvals.
2. Assign the merge request to the first person in the above list.
If you are a reviewer, please follow these steps:
1. Review the merge request. If it is good to go, approve it.
2. Once approved, assign to the next person in the above list. If you are
the last person in the list, merge the merge request.
MARKDOWN
end
if gitlab.mr_labels.include?('CSS cleanup')
mention_single_codebase_approvers
end