Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/issue-handler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Issue Auto Handler

on:
issues:
types: [opened, edited]

jobs:
manage-issues:
runs-on: ubuntu-latest
steps:
- name: Run issue triage bot
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issue = context.payload.issue
const body = issue.body?.toLowerCase() || ""

const spamKeywords = ["pls fix", "help me", "urgent", "asap", "???", "wtf"] // add more keywords here if needed in the futrue
const isSpam = spamKeywords.some(k => body.includes(k))

if (isSpam) {
await github.rest.issues.addLabels({
...context.repo,
issue_number: issue.number,
labels: ['spam']
})

await github.rest.issues.createComment({
...context.repo,
issue_number: issue.number,
body: " This issue seems incomplete or low-effort. Please follow the issue template or provide more details. Thanks!"
})

await github.rest.issues.lock({
...context.repo,
issue_number: issue.number,
lock_reason: "off-topic"
})
} else {
await github.rest.issues.addLabels({
...context.repo,
issue_number: issue.number,
labels: ['triage']
})
await github.rest.issues.createComment({
...context.repo,
issue_number: issue.number,
body: "Thanks for the report! Our team will check this soon "
})
}