debian-mirror-gitlab/danger/documentation/Dangerfile
2020-08-09 17:41:57 +05:30

33 lines
1.2 KiB
Ruby

# frozen_string_literal: true
def gitlab_danger
@gitlab_danger ||= GitlabDanger.new(helper.gitlab_helper)
end
docs_paths_to_review = helper.changes_by_category[:docs]
return if docs_paths_to_review.empty?
message 'This merge request adds or changes files that require a review ' \
'from the Technical Writing team.'
return unless gitlab_danger.ci?
markdown(<<~MARKDOWN)
## Documentation review
The following files require a review from a technical writer:
* #{docs_paths_to_review.map { |path| "`#{path}`" }.join("\n* ")}
The review does not need to block merging this merge request. See the:
- [Technical Writers assignments](https://about.gitlab.com/handbook/engineering/technical-writing/#designated-technical-writers) for the appropriate technical writer for this review.
- [Documentation workflows](https://docs.gitlab.com/ee/development/documentation/workflow.html) for information on when to assign a merge request for review.
MARKDOWN
unless gitlab.mr_labels.include?('documentation')
gitlab.api.update_merge_request(gitlab.mr_json['project_id'],
gitlab.mr_json['iid'],
labels: (gitlab.mr_labels + ['documentation']).join(','))
end