Skip to content

Commit 460713f

Browse files
authored
fix: test URL in PR description replacement (#5280)
* fix: formatting of test URL in PR description * Fix index calculation for test URL removal
1 parent c35e78c commit 460713f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scripts/github/preview-url-pr-description.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ async function previewUrlPrDescription({ github, context }) {
1818
repo,
1919
pull_number: pullNumber
2020
});
21-
const urlSectionStart = '\n<!-- DBUX-TEST-URL-START -->\n';
21+
const urlSectionStart = '\n<!-- DBUX-TEST-URL-START -->';
2222
const urlSectionEnd = '\n<!-- DBUX-TEST-URL-END -->';
23-
const testUrl = `\n🔭🐙🐈 Test this branch here: <https://${owner}.github.io/${repo}/review/${headRef}>\n`;
23+
const testUrl = `\n\n🔭🐙🐈 Test this branch here: <https://${owner}.github.io/${repo}/review/${headRef}>\n`;
2424
let body = pr.data.body || '';
2525
// Remove any existing test URL section
2626
const startIdx = body.indexOf(urlSectionStart);
27-
const endIdx = body.indexOf(urlSectionEnd);
27+
const endIdx = body.lastIndexOf(urlSectionEnd);
2828
if (startIdx !== -1 && endIdx !== -1 && endIdx > startIdx) {
2929
body =
3030
body.slice(0, startIdx) + body.slice(endIdx + urlSectionEnd.length);

0 commit comments

Comments
 (0)