From a4c2b67e72c82dbf2a29928821c6e6cbce19ca8a Mon Sep 17 00:00:00 2001 From: bowenliang123 Date: Tue, 6 Oct 2026 09:13:11 +0800 Subject: [PATCH] ci: auto-close issues whose title matches a blocked pattern Fires on issue creation; currently the only blocked pattern is 'dsh-plugin.org' (case-insensitive). Matching issues are closed as not planned with an explanatory comment. Add further conditions by appending to the patterns array. --- .github/workflows/auto-close-issues.yml | 33 +++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/auto-close-issues.yml diff --git a/.github/workflows/auto-close-issues.yml b/.github/workflows/auto-close-issues.yml new file mode 100644 index 0000000..2c59f68 --- /dev/null +++ b/.github/workflows/auto-close-issues.yml @@ -0,0 +1,33 @@ +name: Auto-close issues + +on: + issues: + types: [opened] + +permissions: + issues: write + +jobs: + auto-close: + runs-on: ubuntu-latest + steps: + - name: Close the issue as not planned when its title matches a blocked pattern + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ISSUE_NUMBER: ${{ github.event.issue.number }} + ISSUE_TITLE: ${{ github.event.issue.title }} + run: | + # One case-insensitive substring per line; a title matching any of + # them gets the issue closed as not planned. + patterns=( + 'dsh-plugin.org' + ) + title="$(printf '%s' "$ISSUE_TITLE" | tr '[:upper:]' '[:lower:]')" + for pattern in "${patterns[@]}"; do + if [[ "$title" == *"$pattern"* ]]; then + gh issue close "$ISSUE_NUMBER" --repo "$GITHUB_REPOSITORY" --reason "not planned" \ + --comment "Closed automatically: the title matches a blocked pattern (\`$pattern\`)." + exit 0 + fi + done + echo "No blocked pattern matched; leaving the issue open."