Skip to content

Commit

Permalink
fix(body): Apply the same indentation on the relations block as present
Browse files Browse the repository at this point in the history
  • Loading branch information
marcbachmann committed Apr 30, 2024
1 parent 38b1c68 commit 5585714
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backport.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ async function requestReviewers (context, prId, reviewers) {

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

0 comments on commit 5585714

Please sign in to comment.