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

Dangerfile « documentation « danger - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 01ef5dbb49e1b2e48537c332b3ea09e511a8b7b4 (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
# frozen_string_literal: true

def feature_mr?
  (helper.mr_labels & %w[feature::addition feature::enhancement]).any?
end

DOCUMENTATION_UPDATE_MISSING = <<~MSG
~"feature::addition" and ~"feature::enhancement" merge requests normally have a documentation change. Consider adding a documentation update or confirming the documentation plan with the [Technical Writer counterpart](https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers).

For more information, see:

- The Handbook page on [merge request types](https://about.gitlab.com/handbook/engineering/metrics/#work-type-classification).
- The [definition of done](https://docs.gitlab.com/ee/development/contributing/merge_request_workflow.html#definition-of-done) documentation.
MSG

docs_paths_to_review = project_helper.changes_by_category[:docs]

# Documentation should be updated for feature::addition and feature::enhancement
if docs_paths_to_review.empty?
  warn(DOCUMENTATION_UPDATE_MISSING) if feature_mr?

  return
end

message 'This merge request adds or changes documentation files. A review from the Technical Writing team before you merge is **recommended**. Reviews can happen after you merge.'

return unless helper.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:

  - [Metadata for the `*.md` files](https://docs.gitlab.com/ee/development/documentation/#metadata) that you've changed. The first few lines of each `*.md` file identify the stage and group most closely associated with your docs change.
  - The [Technical Writer assigned](https://about.gitlab.com/handbook/engineering/technical-writing/#designated-technical-writers) for that stage and group.
  - [Documentation workflows](https://docs.gitlab.com/ee/development/documentation/workflow.html) for information on when to assign a merge request for review.
MARKDOWN