mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
devops: rework client side changes bot (#8877)
This commit is contained in:
parent
5eca7aa1d9
commit
5b1440e14a
@ -14,20 +14,41 @@ jobs:
|
|||||||
- name: Create GitHub issue
|
- name: Create GitHub issue
|
||||||
uses: actions/github-script@v4
|
uses: actions/github-script@v4
|
||||||
with:
|
with:
|
||||||
|
github-token: ${{ secrets.GH_SERVICE_ACCOUNT_TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
const { data } = await github.git.getCommit({
|
const { data } = await github.git.getCommit({
|
||||||
owner: 'microsoft',
|
owner: context.repo.owner,
|
||||||
repo: 'playwright',
|
repo: context.repo.repo,
|
||||||
commit_sha: '${{ github.sha }}',
|
commit_sha: context.sha,
|
||||||
});
|
});
|
||||||
const commitHeader = data.message.split('\n')[0];
|
const commitHeader = data.message.split('\n')[0];
|
||||||
const body = `${{ github.sha }} made changes to the client, this needs to get applied in:
|
|
||||||
- [ ] Python
|
const title = '[Ports]: Backport client side changes';
|
||||||
- [ ] Java
|
for (const repo of ['playwright-python', 'playwright-java', 'playwright-dotnet']) {
|
||||||
- [ ] .NET`;
|
const { data: issuesData } = await github.search.issuesAndPullRequests({
|
||||||
await github.issues.create({
|
q: `is:issue is:open repo:microsoft/${repo} in:title "${title}"`
|
||||||
owner: 'microsoft',
|
})
|
||||||
repo: 'playwright',
|
let issueNumber = null;
|
||||||
title: `[Ports] Apply: ${commitHeader}`,
|
let issueBody = '';
|
||||||
body,
|
if (issuesData.total_count > 0) {
|
||||||
});
|
issueNumber = issuesData.items[0].number
|
||||||
|
issueBody = issuesData.items[0].body
|
||||||
|
} else {
|
||||||
|
const { data: issueCreateData } = await github.issues.create({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: repo,
|
||||||
|
title,
|
||||||
|
body: 'Please backport client side changes: \n',
|
||||||
|
});
|
||||||
|
issueNumber = issueCreateData.number;
|
||||||
|
issueBody = issueCreateData.body;
|
||||||
|
}
|
||||||
|
const newBody = issueBody.trimEnd() + `
|
||||||
|
- [ ] https://github.com/${context.repo.owner}/${context.repo.repo}/commit/${context.sha} (${commitHeader})`;
|
||||||
|
const data = await github.issues.update({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: repo,
|
||||||
|
issue_number: issueNumber,
|
||||||
|
body: newBody
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user