summaryrefslogtreecommitdiff
path: root/danger/documentation/Dangerfile
blob: f5923a22af9287841a4c1a60ec507716705dffb9 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# 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

docs_paths_to_review = docs_paths_requiring_review(helper.all_changed_files)

unless docs_paths_to_review.empty?
  message 'This merge request adds or changes files that require a ' \
    'review from the docs team.'

  markdown(<<~MARKDOWN)
## Docs Review

The following files require a review from the Documentation team:

* #{docs_paths_to_review.map { |path| "`#{path}`" }.join("\n* ")}

To make sure these changes are reviewed, mention a technical writer in a separate
comment, and explain what needs to be reviewed. Please don't mention them
until your changes are ready for review.

Who to ping [based on DevOps stages](https://about.gitlab.com/handbook/product/categories/#devops-stages):

- `@axil`: ~Distribution ~Packaging ~Monitoring ~Secure ~Gitaly ~Gitter
- `@eread`: ~Manage ~Geo ~Verify ~Configure
- `@marcia`: ~Create ~Release
- `@mikelewis`: ~Plan

If you don't know who to ping, or your change doesn't fall under one of the above
categories, you can mention the whole team with `@gl-docsteam`.
  MARKDOWN

  unless gitlab.mr_labels.include?('Documentation')
    warn 'This merge request is missing the ~Documentation label.'
  end
end