From f2efae8b017a09f7db6cc87f0aef93db49429b59 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Sat, 28 Nov 2020 21:43:42 +0800 Subject: [PATCH] Improve the issue/pr interceptor --- .github/workflows/issue-pr-interceptor.yml | 16 +++++++++++++++ .github/workflows/issues-cleaner.yml | 24 ---------------------- .github/workflows/issues-filter.yml | 18 ---------------- 3 files changed, 16 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/issue-pr-interceptor.yml delete mode 100644 .github/workflows/issues-cleaner.yml delete mode 100644 .github/workflows/issues-filter.yml diff --git a/.github/workflows/issue-pr-interceptor.yml b/.github/workflows/issue-pr-interceptor.yml new file mode 100644 index 0000000..39963c5 --- /dev/null +++ b/.github/workflows/issue-pr-interceptor.yml @@ -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." diff --git a/.github/workflows/issues-cleaner.yml b/.github/workflows/issues-cleaner.yml deleted file mode 100644 index 55cb9e1..0000000 --- a/.github/workflows/issues-cleaner.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/issues-filter.yml b/.github/workflows/issues-filter.yml deleted file mode 100644 index 0d2c261..0000000 --- a/.github/workflows/issues-filter.yml +++ /dev/null @@ -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"