From 6c8d9b1d0fd6bef2e7b617bcb1574e69c4fc8780 Mon Sep 17 00:00:00 2001 From: Ian Stapleton Cordasco Date: Wed, 13 Sep 2023 09:33:58 -0500 Subject: [PATCH 1/3] Autoclose specific issue templates We spend a fair amount of time closing issues because people don't read the template closely or understand what they're being told. Let's take advantage of being able to auto-label an issue based on the template and then trigger a workflow to auto-magically close the issue with a message and lock the issue. --- .github/ISSUE_TEMPLATE/Custom.md | 3 ++ .github/ISSUE_TEMPLATE/Feature_request.md | 3 ++ .github/workflows/close-issues.yml | 35 +++++++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 .github/workflows/close-issues.yml diff --git a/.github/ISSUE_TEMPLATE/Custom.md b/.github/ISSUE_TEMPLATE/Custom.md index 19291c1500..332c3aea97 100644 --- a/.github/ISSUE_TEMPLATE/Custom.md +++ b/.github/ISSUE_TEMPLATE/Custom.md @@ -1,6 +1,9 @@ --- name: Request for Help about: Guidance on using Requests. +labels: +- "Question/Not a bug" +- "actions/autoclose-qa" --- diff --git a/.github/ISSUE_TEMPLATE/Feature_request.md b/.github/ISSUE_TEMPLATE/Feature_request.md index dcf6a445fb..544113ae1c 100644 --- a/.github/ISSUE_TEMPLATE/Feature_request.md +++ b/.github/ISSUE_TEMPLATE/Feature_request.md @@ -1,6 +1,9 @@ --- name: Feature request about: Suggest an idea for this project +labels: +- "Feature Request" +- "actions/autoclose-feat" --- diff --git a/.github/workflows/close-issues.yml b/.github/workflows/close-issues.yml new file mode 100644 index 0000000000..6b3d621013 --- /dev/null +++ b/.github/workflows/close-issues.yml @@ -0,0 +1,35 @@ +name: 'Autoclose Issues' + +on: + issues: + types: + - labeled + +permissions: + issues: write + +jobs: + close_qa: + if: github.event.label.name == 'actions/autoclose-qa' + runs-on: ubuntu-latest + steps: + - env: + GITHUB_TOKEN: ${{ secrets.MY_TOKEN }} + ISSUE_URL: ${{ github.event.issue.html_url }} + run: | + gh issue close $ISSUE_URL \ + --comment "As described in the template, this is not the appropriate place for questions. Please use Stack Overflow" \ + --reason completed + gh issue lock $ISSUE_URL --reason off_topic + close_feature_request: + if: github.event.label.name == 'actions/autoclose-feat' + runs-on: ubuntu-latest + steps: + - env: + GITHUB_TOKEN: ${{ secrets.MY_TOKEN }} + ISSUE_URL: ${{ github.event.issue.html_url }} + run: | + gh issue close $ISSUE_URL \ + --comment "As described in the template, Requests is not accepting feature requests" \ + --reason "not planned" + gh issue lock $ISSUE_URL --reason off_topic From f75b9504fc8427c1617bac2dd1e1aa405c9f1b1b Mon Sep 17 00:00:00 2001 From: Ian Stapleton Cordasco Date: Wed, 11 Oct 2023 08:19:14 -0500 Subject: [PATCH 2/3] Update close comment Co-authored-by: Nate Prewitt --- .github/workflows/close-issues.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/close-issues.yml b/.github/workflows/close-issues.yml index 6b3d621013..29fcde7439 100644 --- a/.github/workflows/close-issues.yml +++ b/.github/workflows/close-issues.yml @@ -18,7 +18,7 @@ jobs: ISSUE_URL: ${{ github.event.issue.html_url }} run: | gh issue close $ISSUE_URL \ - --comment "As described in the template, this is not the appropriate place for questions. Please use Stack Overflow" \ + --comment "As described in the template, we won't be able to answer questions on this issue tracker. Please use [Stack Overflow](https://stackoverflow.com/)" \ --reason completed gh issue lock $ISSUE_URL --reason off_topic close_feature_request: From 818776862239a7dd97d39157ec3a202c35af122c Mon Sep 17 00:00:00 2001 From: Ian Stapleton Cordasco Date: Wed, 11 Oct 2023 08:19:57 -0500 Subject: [PATCH 3/3] Update close-issues.yml Remove references to GITHUB_TOKEN/MY_TOKEN --- .github/workflows/close-issues.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/close-issues.yml b/.github/workflows/close-issues.yml index 29fcde7439..f1c177baa5 100644 --- a/.github/workflows/close-issues.yml +++ b/.github/workflows/close-issues.yml @@ -14,7 +14,6 @@ jobs: runs-on: ubuntu-latest steps: - env: - GITHUB_TOKEN: ${{ secrets.MY_TOKEN }} ISSUE_URL: ${{ github.event.issue.html_url }} run: | gh issue close $ISSUE_URL \ @@ -26,7 +25,6 @@ jobs: runs-on: ubuntu-latest steps: - env: - GITHUB_TOKEN: ${{ secrets.MY_TOKEN }} ISSUE_URL: ${{ github.event.issue.html_url }} run: | gh issue close $ISSUE_URL \