From 94868d0d9d4332127f110770d001ed49d17ada6a Mon Sep 17 00:00:00 2001 From: Jakob Guddas Date: Sun, 15 Sep 2024 16:01:07 +0200 Subject: [PATCH] feat: added .github/workflows/close-issue-with-banned-phrases.yml --- .../close-issue-with-banned-phrases.yml | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/close-issue-with-banned-phrases.yml diff --git a/.github/workflows/close-issue-with-banned-phrases.yml b/.github/workflows/close-issue-with-banned-phrases.yml new file mode 100644 index 0000000000..4488676505 --- /dev/null +++ b/.github/workflows/close-issue-with-banned-phrases.yml @@ -0,0 +1,35 @@ +name: Close Issue with Banned Phrases + +on: + issues: + types: [opened] + +jobs: + block_phrases: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Check for blocked phrases in issue title + run: | + ISSUE_TITLE=$(jq -r '.issue.title' "$GITHUB_EVENT_PATH") + BLOCKED_PHRASES=("twitter" "whatsapp" "logo" "google" "tiktok" "facebook" "slack" "discord") + + # Check title and body for blocked phrases + for PHRASE in "${BLOCKED_PHRASES[@]}" + do + if echo "$ISSUE_TITLE" | grep -i "$PHRASE"; then + gh issue close ${{ github.event.issue.number }} --reason "not planned" --comment "This looks like a duplicate, use the search to find similar issues. + + https://github.com/lucide-icons/lucide/issues/670 + + Always happy to help on [Discord](https://discord.gg/EH6nSts)." + gh issue lock ${{ github.event.issue.number }} --reason spam + exit 1 + fi + done + env: + GH_TOKEN: ${{ github.token }}