Make it easier to identify issues created for forward ports

Closes gh-16566
pull/16606/head
Andy Wilkinson 6 years ago
parent e99deb95f7
commit 95149cd7cb

@ -48,7 +48,7 @@ def get_issue(repository, number)
exit 1
end
def create_issue(username, password, repository, original, title, labels, milestone, dry_run)
def create_issue(username, password, repository, original, title, labels, milestone, milestone_name, dry_run)
uri = URI("https://api.github.com/repos/#{repository}/issues")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl=true
@ -58,7 +58,7 @@ def create_issue(username, password, repository, original, title, labels, milest
title: title,
labels: labels,
milestone: milestone.to_i,
body: "See original issue ##{original}."
body: "Forward port of issue ##{original} to #{milestone_name}."
}.to_json
if dry_run then
puts "Dry run"
@ -76,12 +76,13 @@ repository = 'spring-projects/spring-boot'
existing_issue = get_issue(repository, forward_merge.issue)
title = existing_issue['title']
labels = existing_issue['labels'].map { |label| label['name'] }
labels << "status: forward-port"
milestone = find_milestone(repository, forward_merge.milestone)
config = YAML.load_file(File.join(Dir.home, '.spring-boot', 'forward-merge.yml'))
username = config['github']['credentials']['username']
password = config['github']['credentials']['password']
dry_run = config['dry_run']
new_issue_number = create_issue(username, password, repository, forward_merge.issue, title, labels, milestone, dry_run)
puts "Created gh-#{new_issue_number} for forward merge of gh-#{forward_merge.issue} into #{forward_merge.milestone}"
new_issue_number = create_issue(username, password, repository, forward_merge.issue, title, labels, milestone, forward_merge.milestone, dry_run)
puts "Created gh-#{new_issue_number} for forward port of gh-#{forward_merge.issue} into #{forward_merge.milestone}"
rewritten_message = forward_merge.message.sub(forward_merge.line, "Closes gh-#{new_issue_number}")
File.write(message_file, rewritten_message)

Loading…
Cancel
Save