Fix repo:changelog task matching strings that are not Pull Request identifiers (#26280)

This commit is contained in:
Claire 2023-08-14 18:47:43 +02:00 committed by GitHub
parent f5778caa3a
commit 3a8370e1f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -49,8 +49,8 @@ namespace :repo do
File.open(path, 'r') do |file| File.open(path, 'r') do |file|
file.each_line do |line| file.each_line do |line|
if line.start_with?('-') if line.start_with?('-')
new_line = line.gsub(/#([[:digit:]]+)*/) do |pull_request_reference| new_line = line.gsub(/[(]#([[:digit:]]+)[)]\Z/) do |pull_request_reference|
pull_request_number = pull_request_reference[1..] pull_request_number = pull_request_reference[2..-2]
response = nil response = nil
loop do loop do
@ -66,7 +66,7 @@ namespace :repo do
end end
pull_request = Oj.load(response.to_s) pull_request = Oj.load(response.to_s)
"[#{pull_request['user']['login']}](#{pull_request['html_url']})" "([#{pull_request['user']['login']}](#{pull_request['html_url']}))"
end end
tmp.puts new_line tmp.puts new_line