mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-12 22:51:18 +08:00
chore: add action to check for repro
This commit is contained in:
42
.github/workflows/check-repro.yml
vendored
Normal file
42
.github/workflows/check-repro.yml
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
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@v2
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const body = context.payload.comment
|
||||
? context.payload.comment.body
|
||||
: context.payload.issue.body
|
||||
|
||||
if (!/https?:\/\/((github\.com\/[^/]+\/[^/]+)|(snack\.expo\.io\/.+))/gm.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(e.message)) {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user