Skip to content

Allow changelog plugin to be run in dry-run mode in MR revert

Peter Leitzen requested to merge pl-changelog-revert-dry-run into master

What does this MR do and why?

Previously, the changelog plugin could not handle the following case:

  1. Danger is run in dry-run mode (no API token)
  2. Danger is run in a MR revert

It always failed because it was unable to fetch the current milestone and MR labels.

To side-step this issue we allow revert MRs to pass this change in this case.

Refs gitlab-org/gitlab#466701 (comment 1946291381)

How to verify on CI

  1. Create a single commit with the message Revert "me"
  2. Ensure that a required reason is triggered changelog (e.g. feature_flag removed)
diff --git a/lib/danger/plugins/changelog.rb b/lib/danger/plugins/changelog.rb
index d485eeb..5aab240 100644
--- a/lib/danger/plugins/changelog.rb
+++ b/lib/danger/plugins/changelog.rb
@@ -208,7 +208,7 @@ module Danger
     def required_reasons
       [].tap do |reasons|
         reasons << :db_changes if helper.changes.added.has_category?(:migration)
-        reasons << :feature_flag_removed if helper.changes.deleted.has_category?(:feature_flag)
+        reasons << :feature_flag_removed # if helper.changes.deleted.has_category?(:feature_flag)
       end
     end
 
  1. Commit and push
  2. Check output of danger-review and danger-review dry-run CI jobs
  3. Apply regression:17.1 (current milestone) and re-run CI jobs
Before Before with regression After After with regression
danger-review
danger-review dry-run
danger-review
danger-review dry-run
dange-review
danger-review dry-run
danger-review
danger-review dry-run
Edited by Peter Leitzen

Merge request reports

Loading