diff options
Diffstat (limited to 'danger/feature_flag/Dangerfile')
-rw-r--r-- | danger/feature_flag/Dangerfile | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/danger/feature_flag/Dangerfile b/danger/feature_flag/Dangerfile index 089ee2dc50b..cda0e7f3bcc 100644 --- a/danger/feature_flag/Dangerfile +++ b/danger/feature_flag/Dangerfile @@ -52,6 +52,23 @@ def message_for_feature_flag_with_group!(feature_flag:, mr_group_label:) end end -feature_flag.feature_flag_files.each do |feature_flag| +feature_flag.feature_flag_files(change_type: :added).each do |feature_flag| check_feature_flag_yaml(feature_flag) end + +if feature_flag.feature_flag_files(change_type: :added).any? || + feature_flag.feature_flag_files(change_type: :deleted).any? + new_mr_title = helper.mr_title.dup + 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? + + if new_mr_title != helper.mr_title + gitlab.api.update_merge_request( + gitlab.mr_json['project_id'], + gitlab.mr_json['iid'], + title: new_mr_title + ) + gitlab.api.post("/projects/#{gitlab.mr_json['project_id']}/merge_requests/#{gitlab.mr_json['iid']}/pipelines") + message %(You're adding or removing a feature flag, and your MR title didn't include `[RUN ALL RSPEC] [RUN AS-IF-FOSS]`, so we've updated it and started a new MR pipeline to ensure everything is covered.) + end +end |