From 1dfb15663ac57f7776c02742bd5aad8af2cc7b75 Mon Sep 17 00:00:00 2001 From: iBug Date: Mon, 10 Jan 2022 20:59:04 +0800 Subject: [PATCH] Automatically close invalid PRs using GitHub Actions (#3313) * Try auto-closing bad PRs * Include empty PR body as well * Add "Type: Invalid" label as well --- .github/PULL_REQUEST_TEMPLATE.md | 7 ++++++- .github/workflows/bad-pr.yml | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/bad-pr.yml diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index df3d98d9c034..2c5d045a13f9 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -23,4 +23,9 @@ \ No newline at end of file +--> + + diff --git a/.github/workflows/bad-pr.yml b/.github/workflows/bad-pr.yml new file mode 100644 index 000000000000..ce9de201d2de --- /dev/null +++ b/.github/workflows/bad-pr.yml @@ -0,0 +1,18 @@ +name: Cleanup bad PR + +on: + pull_request_target: + types: [opened, reopened] + +jobs: + close-pr: + runs-on: ubuntu-latest + if: "contains(github.event.pull_request.body, 'CHECK_PR_DID_NOT_CONFIRM') || github.event.pull_request.body == ''" + steps: + - uses: actions-ecosystem/action-add-labels@v1 + with: + labels: 'Type: Invalid' + - uses: superbrothers/close-pull-request@v3 + with: + # Optional. Post an issue comment just before closing a pull request. + comment: "This PR is not valid for inclusion. Please check again if you're submitting improvements for *the theme*."