debian-mirror-gitlab/danger/documentation/Dangerfile

36 lines
1,012 B
Ruby
Raw Normal View History

2018-11-20 20:47:30 +05:30
# frozen_string_literal: true
# All the files/directories that should be reviewed by the Docs team.
DOCS_FILES = [
'doc/'
].freeze
def docs_paths_requiring_review(files)
files.select do |file|
DOCS_FILES.any? { |pattern| file.start_with?(pattern) }
end
end
2018-12-13 13:39:08 +05:30
docs_paths_to_review = docs_paths_requiring_review(helper.all_changed_files)
2018-11-20 20:47:30 +05:30
unless docs_paths_to_review.empty?
message 'This merge request adds or changes files that require a ' \
2019-01-03 12:48:30 +05:30
'review from the docs team.'
2018-11-20 20:47:30 +05:30
markdown(<<~MARKDOWN)
2019-01-03 12:48:30 +05:30
## Docs Review
2018-11-20 20:47:30 +05:30
The following files require a review from the Documentation team:
* #{docs_paths_to_review.map { |path| "`#{path}`" }.join("\n* ")}
2019-01-03 12:48:30 +05:30
To make sure these changes are reviewed, mention `@gl-docsteam` in a separate
comment, and explain what needs to be reviewed by the team. Please don't mention
the team until your changes are ready for review.
2018-11-20 20:47:30 +05:30
MARKDOWN
unless gitlab.mr_labels.include?('Documentation')
warn 'This merge request is missing the ~Documentation label.'
end
end