Add workflow to lock spam issues

This commit is contained in:
bbhtt
2025-01-29 21:12:52 +05:30
parent 43d377f2f0
commit 413fc48b0d
+25
View File
@@ -0,0 +1,25 @@
name: Close and lock spam issues
on:
issues:
types: [labeled]
workflow_dispatch:
jobs:
handle_spam:
if: github.event.label.name == 'spam'
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Close the issue
run: gh issue close "$ISSUE_NUM" --reason "not planned"
- name: Lock the issue
run: |
if [ "$(gh api repos/"$GH_REPO"/issues/"$ISSUE_NUM" --jq '.locked')" = "false" ]; then
gh issue lock "$ISSUE_NUM" --reason "spam"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
ISSUE_NUM: ${{ github.event.issue.number }}