2021-08-25 14:36:57 +03:00
|
|
|
|
name: "Check client side changes"
|
|
|
|
|
on:
|
2021-08-27 13:22:49 +03:00
|
|
|
|
push:
|
2021-08-25 14:36:57 +03:00
|
|
|
|
branches:
|
2021-12-08 09:58:33 +03:00
|
|
|
|
- main
|
2021-08-25 14:36:57 +03:00
|
|
|
|
paths:
|
2021-11-04 01:34:57 +03:00
|
|
|
|
- 'packages/playwright-core/src/client/**/*'
|
2021-08-25 14:36:57 +03:00
|
|
|
|
jobs:
|
|
|
|
|
check:
|
|
|
|
|
name: Check
|
|
|
|
|
runs-on: ubuntu-20.04
|
2021-08-27 13:22:49 +03:00
|
|
|
|
if: github.repository == 'microsoft/playwright'
|
2021-08-25 14:36:57 +03:00
|
|
|
|
steps:
|
|
|
|
|
- name: Create GitHub issue
|
|
|
|
|
uses: actions/github-script@v4
|
|
|
|
|
with:
|
2021-09-13 23:46:57 +03:00
|
|
|
|
github-token: ${{ secrets.GH_SERVICE_ACCOUNT_TOKEN }}
|
2021-08-25 14:36:57 +03:00
|
|
|
|
script: |
|
2021-09-01 11:40:36 +03:00
|
|
|
|
const { data } = await github.git.getCommit({
|
2021-09-13 23:46:57 +03:00
|
|
|
|
owner: context.repo.owner,
|
|
|
|
|
repo: context.repo.repo,
|
|
|
|
|
commit_sha: context.sha,
|
2021-08-31 20:48:18 +03:00
|
|
|
|
});
|
2021-09-01 11:40:36 +03:00
|
|
|
|
const commitHeader = data.message.split('\n')[0];
|
2021-09-13 23:46:57 +03:00
|
|
|
|
|
|
|
|
|
const title = '[Ports]: Backport client side changes';
|
|
|
|
|
for (const repo of ['playwright-python', 'playwright-java', 'playwright-dotnet']) {
|
|
|
|
|
const { data: issuesData } = await github.search.issuesAndPullRequests({
|
|
|
|
|
q: `is:issue is:open repo:microsoft/${repo} in:title "${title}"`
|
|
|
|
|
})
|
|
|
|
|
let issueNumber = null;
|
|
|
|
|
let issueBody = '';
|
|
|
|
|
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
|
|
|
|
|
})
|
|
|
|
|
}
|