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>2020-09-03 21:08:29 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-09-03 21:08:29 +0300
commit592223823c8ebf6e32d98e4b12620ba8ff043cca (patch)
tree1c665b754b1487df374d9cb28cfc61ff40a6b317 /danger
parent0e13b2c71563d578805fc01fda9a4361f9f9d053 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'danger')
-rw-r--r--danger/database/Dangerfile8
-rw-r--r--danger/documentation/Dangerfile6
-rw-r--r--danger/specialization_labels/Dangerfile25
3 files changed, 28 insertions, 11 deletions
diff --git a/danger/database/Dangerfile b/danger/database/Dangerfile
index 41ca2aa1978..ca4b151faf9 100644
--- a/danger/database/Dangerfile
+++ b/danger/database/Dangerfile
@@ -59,11 +59,9 @@ if gitlab.mr_labels.include?('database') || db_paths_to_review.any?
markdown(DB_MESSAGE)
markdown(DB_FILES_MESSAGE + helper.markdown_list(db_paths_to_review)) if db_paths_to_review.any?
- database_labels = helper.missing_database_labels(gitlab.mr_labels)
-
- if database_labels.any?
+ unless has_database_scoped_labels?(gitlab.mr_labels)
gitlab.api.update_merge_request(gitlab.mr_json['project_id'],
- gitlab.mr_json['iid'],
- labels: (gitlab.mr_labels + database_labels).join(','))
+ gitlab.mr_json['iid'],
+ add_labels: 'database::review pending')
end
end
diff --git a/danger/documentation/Dangerfile b/danger/documentation/Dangerfile
index 1dd6d484968..16d22969fbd 100644
--- a/danger/documentation/Dangerfile
+++ b/danger/documentation/Dangerfile
@@ -25,9 +25,3 @@ markdown(<<~MARKDOWN)
- [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
diff --git a/danger/specialization_labels/Dangerfile b/danger/specialization_labels/Dangerfile
new file mode 100644
index 00000000000..b12771b9807
--- /dev/null
+++ b/danger/specialization_labels/Dangerfile
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+gitlab_danger = GitlabDanger.new(helper.gitlab_helper)
+
+return unless gitlab_danger.ci?
+
+SPECIALIZATIONS = {
+ database: 'database',
+ backend: 'backend',
+ frontend: 'frontend',
+ docs: 'documentation',
+ qa: 'QA',
+ engineering_productivity: 'Engineering Productivity'
+}.freeze
+
+labels_to_add = helper.changes_by_category.each_with_object([]) do |(category, _changes), memo|
+ label = SPECIALIZATIONS.fetch(category, category.to_s)
+ memo << label unless gitlab.mr_labels.include?(label)
+end
+
+if labels_to_add.any?
+ gitlab.api.update_merge_request(gitlab.mr_json['project_id'],
+ gitlab.mr_json['iid'],
+ add_labels: labels_to_add.join(','))
+end