gitlab-org--gitlab-foss/danger/datateam/Dangerfile

20 lines
595 B
Ruby

# frozen_string_literal: true
DATA_WAREHOUSE_LABELS = [
"Data Warehouse::Impact Check",
"Data Warehouse::Impacted",
"Data Warehouse::Not Impacted"
].freeze
CHANGED_SCHEMA_MESSAGE = <<~MSG
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?
no_data_warehouse_labels = (gitlab.mr_labels & DATA_WAREHOUSE_LABELS).empty?
markdown(CHANGED_SCHEMA_MESSAGE) if db_schema_updated && no_data_warehouse_labels