From efc5651134e974b1cc90ca435379fd5513962b8d Mon Sep 17 00:00:00 2001 From: Dennis van Rooijen <dvanrooijen@gitlab.com> Date: Wed, 14 Jul 2021 05:44:36 +0000 Subject: [PATCH] Add data warehouse labels to MR upon schema change --- danger/datateam/Dangerfile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/danger/datateam/Dangerfile b/danger/datateam/Dangerfile index 0a33cb6777bf3..e054cddce0631 100644 --- a/danger/datateam/Dangerfile +++ b/danger/datateam/Dangerfile @@ -1,14 +1,24 @@ # frozen_string_literal: true # rubocop:disable Style/SignalException +DATA_WAREHOUSE_LABELS = [ + "Data Warehouse::Impact Check", + "Data Warehouse::Impacted", + "Data Warehouse::Not Impacted" +].freeze + CHANGED_SCHEMA_MESSAGE = <<~MSG -Mentioning @gitlab-data/engineers to notify the team about changes to the db/structure.sql file. +Notification to the Data Team about changes to the db/structure.sql file, add label `Data Warehouse::Impact Check`. + +/label ~"Data Warehouse::Impact Check" MSG db_schema_updated = !git.modified_files.grep(%r{\Adb/structure\.sql}).empty? -if db_schema_updated +no_data_warehouse_labels = (gitlab.mr_labels & DATA_WAREHOUSE_LABELS).empty? + +if db_schema_updated && no_data_warehouse_labels markdown(CHANGED_SCHEMA_MESSAGE) -- GitLab