mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 21:53:35 +03:00
55 lines
2.0 KiB
YAML
55 lines
2.0 KiB
YAML
name: "Check client side changes"
|
||
on:
|
||
push:
|
||
branches:
|
||
- master
|
||
paths:
|
||
- 'src/client/**/*'
|
||
jobs:
|
||
check:
|
||
name: Check
|
||
runs-on: ubuntu-20.04
|
||
if: github.repository == 'microsoft/playwright'
|
||
steps:
|
||
- name: Create GitHub issue
|
||
uses: actions/github-script@v4
|
||
with:
|
||
github-token: ${{ secrets.GH_SERVICE_ACCOUNT_TOKEN }}
|
||
script: |
|
||
const { data } = await github.git.getCommit({
|
||
owner: context.repo.owner,
|
||
repo: context.repo.repo,
|
||
commit_sha: context.sha,
|
||
});
|
||
const commitHeader = data.message.split('\n')[0];
|
||
|
||
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
|
||
})
|
||
}
|