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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/danger
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-11-15 00:07:19 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-11-15 00:07:19 +0300
commiteaa1d6fdd776adb3df4a820d3b66588541fd2710 (patch)
tree0dc004c149c477c923f30fd37ed934db1d0fd88d /danger
parentc3ccd2fdf136f7b3962ef5243ed6ce01de47d8ef (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'danger')
-rw-r--r--danger/documentation/Dangerfile87
1 files changed, 61 insertions, 26 deletions
diff --git a/danger/documentation/Dangerfile b/danger/documentation/Dangerfile
index 78f8c87a528..1bdcd58841a 100644
--- a/danger/documentation/Dangerfile
+++ b/danger/documentation/Dangerfile
@@ -8,45 +8,80 @@ def doc_path_to_url(path)
path.sub("doc/", "https://docs.gitlab.com/ee/").sub("index.md", "").sub(".md", "/")
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/product/ux/technical-writing/#assignments).
+docs_paths_to_review = helper.changes_by_category[:docs]
-For more information, see:
+# Some docs do not need a review from a Technical Writer.
+# In these cases, we'll output a message specific to the section.
+sections_with_no_tw_review = {
+ 'doc/solutions' => [],
+ 'doc/development' => []
+}.freeze
-- 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
+# One exception to the exceptions above: Technical Writing docs should get a TW review.
+TW_DOCS_PATH = 'doc/development/documentation'
-docs_paths_to_review = helper.changes_by_category[:docs]
+docs_paths_to_review.reject! do |doc|
+ section_with_no_tw_review = sections_with_no_tw_review.keys.find { |skip_path| doc.start_with?(skip_path) && !doc.start_with?(TW_DOCS_PATH) }
+ next unless section_with_no_tw_review
-# Some docs do not need a review from a technical writer
-SKIP_TW_REVIEW_PATHS = ['doc/solutions'].freeze
+ sections_with_no_tw_review[section_with_no_tw_review] << doc
-docs_paths_to_review.delete_if do |item|
- SKIP_TW_REVIEW_PATHS.any? { |skip_path| item.start_with?(skip_path) }
+ true
end
-# Documentation should be updated for feature::addition and feature::enhancement
-if docs_paths_to_review.empty?
- warn(DOCUMENTATION_UPDATE_MISSING) if feature_mr?
+SOLUTIONS_LABELS = %w[Solutions].freeze
+DEVELOPMENT_LABELS = ['docs::improvement', 'development guidelines'].freeze
+
+def no_tw_review_label_message(labels)
+ helper.labels_to_add.concat(%w[documentation type::maintenance maintenance::refactor] + labels)
- return
+ 'You do not need tech writer review.'
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.'
+SOLUTIONS_MESSAGE = <<~MSG.freeze
+This MR contains docs in the /solutions directory and should be reviewed by a Solutions Architect approver. #{no_tw_review_label_message(SOLUTIONS_LABELS)}
+MSG
-return unless helper.ci?
+DEVELOPMENT_MESSAGE = <<~MSG.freeze
+This MR contains docs in the /development directory. Any Maintainer, other than the author, can merge. #{no_tw_review_label_message(DEVELOPMENT_LABELS)}
+MSG
-markdown(<<~MARKDOWN)
- ## Documentation review
+# For regular pages, prompt for a TW review
+DOCS_UPDATE_SHORT_MESSAGE = <<~MSG
+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.
+MSG
+
+DOCS_UPDATE_LONG_MESSAGE = <<~MSG.freeze
+## Documentation review
- The following files require a review from a technical writer:
+The following files require a review from a technical writer:
- * #{docs_paths_to_review.map { |path| "`#{path}` ([Link to current live version](#{doc_path_to_url(path)}))" }.join("\n* ")}
+* #{docs_paths_to_review.map { |path| "`#{path}` ([Link to current live version](#{doc_path_to_url(path)}))" }.join("\n* ")}
- The review does not need to block merging this merge request. See the:
+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/product/ux/technical-writing/#assignments) 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
+- [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/product/ux/technical-writing/#assignments) 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.
+MSG
+
+# Documentation should be updated for feature::addition and feature::enhancement
+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/product/ux/technical-writing/#assignments).
+
+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
+
+# Output messages
+warn(DOCUMENTATION_UPDATE_MISSING) if docs_paths_to_review.empty? && feature_mr?
+
+message(SOLUTIONS_MESSAGE) if sections_with_no_tw_review["doc/solutions"].any?
+message(DEVELOPMENT_MESSAGE) if sections_with_no_tw_review["doc/development"].any?
+
+unless docs_paths_to_review.empty?
+ message(DOCS_UPDATE_SHORT_MESSAGE)
+ markdown(DOCS_UPDATE_LONG_MESSAGE)
+end