Skip to content

Commit

Permalink
fix: Detect spaces better when using a relations block with multiple …
Browse files Browse the repository at this point in the history
…newlines until the next line
  • Loading branch information
marcbachmann committed May 29, 2024
1 parent 953c4f6 commit 0a23571
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion backport.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async function requestReviewers (context, prId, reviewers) {

function patchPullRequestBody (pr) {
const body = pr.body || ''
const indent = /Relations:\r?\n( *)-/.exec(body)?.[1].length || 0
const indent = /Relations:\s+?( *)-/.exec(body)?.[1].length || 0
const msg = `Relations:\r\n${' '.repeat(indent)}- Master: #${pr.number}`
if (body.includes('Relations:')) return body.replace('Relations:', msg)
return `${msg}\n${body}`
Expand Down

0 comments on commit 0a23571

Please sign in to comment.