From 95149cd7cbe380042fd9335486bb59feee221f7d Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 15 Apr 2019 16:58:20 +0100 Subject: [PATCH] Make it easier to identify issues created for forward ports Closes gh-16566 --- git/hooks/forward-merge | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/git/hooks/forward-merge b/git/hooks/forward-merge index 3ae02e1031..3aba7b6117 100755 --- a/git/hooks/forward-merge +++ b/git/hooks/forward-merge @@ -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)