mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-28 20:35:19 +08:00
49 lines
1.4 KiB
YAML
49 lines
1.4 KiB
YAML
name: Check for repro
|
|
on:
|
|
issues:
|
|
types: [opened, edited]
|
|
issue_comment:
|
|
types: [created, edited]
|
|
|
|
jobs:
|
|
check-repro:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/github-script@v3
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
script: |
|
|
const user = context.payload.sender.login;
|
|
const body = context.payload.comment
|
|
? context.payload.comment.body
|
|
: context.payload.issue.body;
|
|
|
|
const regex = new RegExp(
|
|
`https?:\\/\\/((github\\.com\\/${user}\\/[^/]+\\/?[\\s\\n]+)|(snack\\.expo\\.io\\/.+))`,
|
|
'gm'
|
|
);
|
|
|
|
if (!regex.test(body)) {
|
|
return;
|
|
}
|
|
|
|
await github.issues.addLabels({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
labels: ['repro provided'],
|
|
});
|
|
|
|
try {
|
|
await github.issues.removeLabel({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
name: 'needs repro',
|
|
});
|
|
} catch (error) {
|
|
if (!/Label does not exist/.test(error.message)) {
|
|
throw error;
|
|
}
|
|
}
|