devops: deduplicate redudant information in client side changes issue (#33666)

This commit is contained in:
Max Schmitt 2024-11-19 19:06:20 +01:00 committed by GitHub
parent aa0ac04d06
commit 7f7b440c72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 3 deletions

View File

@ -27,7 +27,11 @@ jobs:
repo: context.repo.repo, repo: context.repo.repo,
commit_sha: context.sha, 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; const title = '[Ports]: Backport client side changes for ' + currentPlaywrightVersion;
for (const repo of ['playwright-python', 'playwright-java', 'playwright-dotnet']) { for (const repo of ['playwright-python', 'playwright-java', 'playwright-dotnet']) {
@ -50,11 +54,11 @@ jobs:
issueBody = issueCreateData.body; issueBody = issueCreateData.body;
} }
const newBody = issueBody.trimEnd() + ` 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({ const data = await github.rest.issues.update({
owner: context.repo.owner, owner: context.repo.owner,
repo: repo, repo: repo,
issue_number: issueNumber, issue_number: issueNumber,
body: newBody body: newBody
}) })
} }