Commit 5d62db25 authored by Rémy Coutable's avatar Rémy Coutable

Fix changelog Dangerfile to convert MR IID to a string before comparison

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 0d038abc
---
title: Fix changelog Dangerfile to convert MR IID to a string before comparison
merge_request: 60899
author:
type: fixed
......@@ -38,16 +38,17 @@ end
def check_changelog_yaml(path)
raw_file = File.read(path)
yaml = YAML.safe_load(raw_file)
yaml_merge_request = yaml["merge_request"].to_s
fail "`title` should be set, in #{helper.html_link(path)}! #{SEE_DOC}" if yaml["title"].nil?
fail "`type` should be set, in #{helper.html_link(path)}! #{SEE_DOC}" if yaml["type"].nil?
return if helper.security_mr?
return if helper.mr_iid.to_s.empty?
return if helper.mr_iid.empty?
cherry_pick_against_stable_branch = helper.cherry_pick_mr? && helper.stable_branch?
if yaml["merge_request"].nil?
if yaml_merge_request.empty?
mr_line = raw_file.lines.find_index("merge_request:\n")
if mr_line
......@@ -55,7 +56,7 @@ def check_changelog_yaml(path)
else
message "Consider setting `merge_request` to #{helper.mr_iid} in #{helper.html_link(path)}. #{SEE_DOC}"
end
elsif yaml["merge_request"] != helper.mr_iid && !cherry_pick_against_stable_branch
elsif yaml_merge_request != helper.mr_iid && !cherry_pick_against_stable_branch
fail "Merge request ID was not set to #{helper.mr_iid}! #{SEE_DOC}"
end
rescue Psych::Exception
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment