Merge 4c786a9055a48ca2ed7f205eea7dc9561d44a9c8 into 9b4e9788e4a3a731f7567338ed15d3ec549ce03b

This commit is contained in:
🇨🇳钟智强 『江西青垣科技』 2025-10-12 07:40:31 +00:00 committed by GitHub
commit 62ce03fae5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

51
.github/workflows/issue-handler.yml vendored Normal file
View File

@ -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 "
})
}