Improve the issue/pr interceptor

This commit is contained in:
Cotes Chung 2020-11-28 21:43:42 +08:00
parent 8b2e6d1bf5
commit f2efae8b01
3 changed files with 16 additions and 42 deletions

View file

@ -0,0 +1,16 @@
name: "Intercept bad issue/PRs"
on: [issues, pull_request]
jobs:
autoclose:
runs-on: ubuntu-latest
steps:
- name: Autoclose issues that did not follow issue template
uses: roots/issue-closer@v1.1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-pattern: "\\[x\\] I have read"
issue-close-message: "Hi @${issue.user.login} :wave:,\n\nThis issue is being automatically closed because it does not follow the issue template."
pr-pattern: "\\[x\\] Bug|\\[x\\] New feat|\\[x\\] Break|\\[x\\] Doc"
pr-close-message: "Hi @${pull_request.user.login} :wave:,\n\nThis PR is being automatically closed because it does not follow the PR template."

View file

@ -1,24 +0,0 @@
name: "Close stale issues"
on:
schedule:
- cron: "0 0 * * *"
jobs:
stale:
runs-on: ubuntu-latest
steps:
- env:
DAYS_TO_STALE: ${{ 5 }}
DAYS_TO_CLOSE: ${{ 2 }}
uses: actions/stale@v3
with:
repo-token: ${{ secrets.GH_PAT }}
stale-issue-message: 'This issue is stale because it has been open ${{ env.DAYS_TO_STALE }} days with no activity. Remove stale label or comment or this will be closed in ${{ env.DAYS_TO_CLOSE }} days'
stale-issue-label: 'stale'
exempt-issue-labels: 'pending, in progress'
stale-pr-message: 'This PR is stale because it has been open ${{ env.DAYS_TO_STALE }} days with no activity. Remove stale label or comment or this will be closed in ${{ env.DAYS_TO_CLOSE }} days'
stale-pr-label: 'stale'
exempt-pr-labels: 'pending, in progress'
days-before-stale: ${{ env.DAYS_TO_STALE }}
days-before-close: ${{ env.DAYS_TO_CLOSE }}
# debug-only: true

View file

@ -1,18 +0,0 @@
name: "Close Irregular Issues"
on:
issues:
types: [opened, edited]
jobs:
auto_close_issues:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Automatically close issues that don't follow the issue template
uses: lucasbento/auto-close-issues@v1.0.2
with:
github-token: ${{ secrets.GH_PAT }}
issue-close-message: "@${issue.user.login}: hello! :wave:\n\nThis issue is being automatically closed because it does not follow the issue template. \n> Follow the template to edit this issue and it will automatically reopen."
closed-issues-label: "🙁 Not following issue template"