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