From 7f7b440c726b246813d86657aadbf26eee8a8ca8 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Tue, 19 Nov 2024 19:06:20 +0100 Subject: [PATCH] devops: deduplicate redudant information in client side changes issue (#33666) --- .github/workflows/pr_check_client_side_changes.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr_check_client_side_changes.yml b/.github/workflows/pr_check_client_side_changes.yml index 6612845f47..003831dffc 100644 --- a/.github/workflows/pr_check_client_side_changes.yml +++ b/.github/workflows/pr_check_client_side_changes.yml @@ -27,7 +27,11 @@ jobs: repo: context.repo.repo, commit_sha: context.sha, }); - const commitHeader = data.message.split('\n')[0].replace(/#(\d+)/g, 'https://github.com/microsoft/playwright/pull/$1'); + const commitHeader = data.message.split('\n')[0]; + const prMatch = commitHeader.match(/#(\d+)/); + const formattedCommit = prMatch + ? `https://github.com/microsoft/playwright/pull/${prMatch[1]}` + : `https://github.com/${context.repo.owner}/${context.repo.repo}/commit/${context.sha} (${commitHeader})`; const title = '[Ports]: Backport client side changes for ' + currentPlaywrightVersion; for (const repo of ['playwright-python', 'playwright-java', 'playwright-dotnet']) { @@ -50,11 +54,11 @@ jobs: issueBody = issueCreateData.body; } const newBody = issueBody.trimEnd() + ` - - [ ] https://github.com/${context.repo.owner}/${context.repo.repo}/commit/${context.sha} (${commitHeader})`; + - [ ] ${formattedCommit}`; const data = await github.rest.issues.update({ owner: context.repo.owner, repo: repo, issue_number: issueNumber, body: newBody }) - } + } \ No newline at end of file