diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-21 02:50:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-21 02:50:22 +0300 |
commit | 9dc93a4519d9d5d7be48ff274127136236a3adb3 (patch) | |
tree | 70467ae3692a0e35e5ea56bcb803eb512a10bedb /danger/feature_flag/Dangerfile | |
parent | 4b0f34b6d759d6299322b3a54453e930c6121ff0 (diff) |
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc43
Diffstat (limited to 'danger/feature_flag/Dangerfile')
-rw-r--r-- | danger/feature_flag/Dangerfile | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/danger/feature_flag/Dangerfile b/danger/feature_flag/Dangerfile index e66ed35c9ab..d14dd97380f 100644 --- a/danger/feature_flag/Dangerfile +++ b/danger/feature_flag/Dangerfile @@ -2,6 +2,7 @@ # rubocop:disable Style/SignalException SEE_DOC = "See the [feature flag documentation](https://docs.gitlab.com/ee/development/feature_flags#feature-flag-definition-and-validation)." +FEATURE_FLAG_LABEL = "feature flag" SUGGEST_MR_COMMENT = <<~SUGGEST_COMMENT ```suggestion @@ -65,14 +66,21 @@ if feature_flag_file_added_or_removed? new_mr_title << ' [RUN ALL RSPEC]' unless helper.run_all_rspec_mr? new_mr_title << ' [RUN AS-IF-FOSS]' unless helper.run_as_if_foss_mr? + changes = {} + changes[:add_labels] = FEATURE_FLAG_LABEL unless helper.mr_has_labels?(FEATURE_FLAG_LABEL) + if new_mr_title != helper.mr_title + changes[:title] = new_mr_title + else + message "You're adding or removing a feature flag, your MR title needs to include `[RUN ALL RSPEC] [RUN AS-IF-FOSS]` (we may have updated it automatically for you and started a new MR pipeline) to ensure everything is covered." + end + + if changes.any? gitlab.api.update_merge_request( gitlab.mr_json['project_id'], gitlab.mr_json['iid'], - title: new_mr_title + **changes ) gitlab.api.post("/projects/#{gitlab.mr_json['project_id']}/merge_requests/#{gitlab.mr_json['iid']}/pipelines") - else - message "You're adding or removing a feature flag, your MR title needs to include `[RUN ALL RSPEC] [RUN AS-IF-FOSS]` (we may have updated it automatically for you and started a new MR pipeline) to ensure everything is covered." end end |