diff options
Diffstat (limited to 'danger/database/Dangerfile')
-rw-r--r-- | danger/database/Dangerfile | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/danger/database/Dangerfile b/danger/database/Dangerfile index 67a9b53fe3a..af4d6ed513d 100644 --- a/danger/database/Dangerfile +++ b/danger/database/Dangerfile @@ -1,7 +1,5 @@ # frozen_string_literal: true -gitlab_danger = GitlabDanger.new(helper.gitlab_helper) - SCHEMA_NOT_UPDATED_MESSAGE_SHORT = "New %<migrations>s added but %<schema>s wasn't updated" SCHEMA_NOT_UPDATED_MESSAGE_FULL = <<~MSG @@ -35,20 +33,20 @@ geo_db_schema_updated = !git.modified_files.grep(%r{\Aee/db/geo/schema\.rb}).emp non_geo_migration_created = !git.added_files.grep(%r{\A(db/(post_)?migrate)/}).empty? geo_migration_created = !git.added_files.grep(%r{\Aee/db/geo/(post_)?migrate/}).empty? -format_str = gitlab_danger.ci? ? SCHEMA_NOT_UPDATED_MESSAGE_FULL : SCHEMA_NOT_UPDATED_MESSAGE_SHORT +format_str = helper.ci? ? SCHEMA_NOT_UPDATED_MESSAGE_FULL : SCHEMA_NOT_UPDATED_MESSAGE_SHORT if non_geo_migration_created && !non_geo_db_schema_updated - warn format(format_str, migrations: 'migrations', schema: gitlab_danger.html_link("db/structure.sql")) + warn format(format_str, migrations: 'migrations', schema: helper.html_link("db/structure.sql")) end if geo_migration_created && !geo_db_schema_updated - warn format(format_str, migrations: 'Geo migrations', schema: gitlab_danger.html_link("ee/db/geo/schema.rb")) + warn format(format_str, migrations: 'Geo migrations', schema: helper.html_link("ee/db/geo/schema.rb")) end -return unless gitlab_danger.ci? +return unless helper.ci? return if gitlab.mr_labels.include?(DATABASE_APPROVED_LABEL) -db_paths_to_review = helper.changes_by_category[:database] +db_paths_to_review = project_helper.changes_by_category[:database] if gitlab.mr_labels.include?('database') || db_paths_to_review.any? message 'This merge request adds or changes files that require a ' \ |