From 3a8370e1f459f5cf9695a610102ae6e53df36714 Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 14 Aug 2023 18:47:43 +0200 Subject: [PATCH] Fix `repo:changelog` task matching strings that are not Pull Request identifiers (#26280) --- lib/tasks/repo.rake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/tasks/repo.rake b/lib/tasks/repo.rake index 33c454444e..1ed1ee5c32 100644 --- a/lib/tasks/repo.rake +++ b/lib/tasks/repo.rake @@ -49,8 +49,8 @@ namespace :repo do File.open(path, 'r') do |file| file.each_line do |line| if line.start_with?('-') - new_line = line.gsub(/#([[:digit:]]+)*/) do |pull_request_reference| - pull_request_number = pull_request_reference[1..] + new_line = line.gsub(/[(]#([[:digit:]]+)[)]\Z/) do |pull_request_reference| + pull_request_number = pull_request_reference[2..-2] response = nil loop do @@ -66,7 +66,7 @@ namespace :repo do end pull_request = Oj.load(response.to_s) - "[#{pull_request['user']['login']}](#{pull_request['html_url']})" + "([#{pull_request['user']['login']}](#{pull_request['html_url']}))" end tmp.puts new_line