Allow changelog plugin to be run in dry-run mode in MR revert
What does this MR do and why?
Previously, the changelog plugin could not handle the following case:
- Danger is run in dry-run mode (no API token)
- 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
- Create a single commit with the message
Revert "me"
- 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
- Commit and push
- Check output of
danger-review
anddanger-review dry-run
CI jobs - 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