Skip to content

Commit 4b4e2eb

Browse files
authored
Update auto-manage-issues.yml
1 parent 32c181d commit 4b4e2eb

File tree

1 file changed

+31
-35
lines changed

1 file changed

+31
-35
lines changed
Lines changed: 31 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,94 @@
1-
name: Auto Manage Specific Issues
1+
# .github/workflows/auto-block-issues.yml
2+
3+
name: Auto Block Sensitive Issues
24

35
on:
46
issues:
57
types: [opened, edited]
68

79
jobs:
8-
auto-manage-issues:
9-
# Only run for non-owners to avoid processing own issues
10+
auto-block-issues:
11+
# Skip processing if the issue is opened/edited by the repository owner
1012
if: github.actor != github.event.repository.owner.login
1113
runs-on: ubuntu-latest
1214
steps:
13-
- name: Check issue content for specific keywords
15+
- name: Detect and block sensitive issues
1416
uses: actions/github-script@v7
1517
with:
1618
script: |
17-
// Get issue title and body (case-insensitive matching)
19+
// Get issue title and body (converted to lowercase)
1820
const title = context.payload.issue.title.toLowerCase();
1921
const body = context.payload.issue.body?.toLowerCase() || '';
2022
21-
// Bilingual keyword list (Chinese + English)
22-
const sensitiveKeywords = [
23+
// List of sensitive keywords in both Chinese and English
24+
const blockKeywords = [
2325
// Chinese keywords
2426
'刷星', '刷赞', '买星', '买赞', '虚假star', '假星',
2527
'可疑账号', '刷热度', '买热度', 'basinarapprowayl',
28+
'刷issue', '刷评论', '买issue', '买评论', '虚假issue', '假issue',
29+
'刷贡献', '买贡献', '贡献造假', 'issue 刷量', '评论 刷量',
2630
2731
// English keywords
2832
'star farming', 'buy star', 'fake star', 'fake stars',
2933
'artificial stars', 'star manipulation', 'buy github stars',
30-
'suspicious account', 'bot accounts'
34+
'suspicious account', 'bot accounts', 'issue farming',
35+
'comment spam', 'spam comments', 'fake issue', 'fake issues',
36+
'buy issue', 'buy issues', 'buy comments', 'contribution fraud',
37+
'activity farming', 'gaming the system'
3138
];
3239
33-
// Check if content contains any sensitive keywords
34-
const hasSensitiveContent = sensitiveKeywords.some(keyword =>
40+
// Check if the title or body contains any of the sensitive keywords
41+
const shouldBlock = blockKeywords.some(keyword =>
3542
title.includes(keyword.toLowerCase()) ||
3643
body.includes(keyword.toLowerCase())
3744
);
3845
39-
if (hasSensitiveContent) {
40-
console.log(`Sensitive content detected in issue #${context.issue.number}. Processing...`);
46+
if (shouldBlock) {
47+
console.log(`Blocking sensitive issue #${context.issue.number}`);
4148
42-
// 1. Add labels (ensure these labels exist in your repository)
49+
// 1. Add a blocked label
4350
try {
4451
await github.rest.issues.addLabels({
4552
owner: context.repo.owner,
4653
repo: context.repo.repo,
4754
issue_number: context.issue.number,
48-
labels: ['🚩auto-flagged', '⚠️needs-review']
55+
labels: ['🚫 blocked']
4956
});
50-
console.log('Labels added successfully');
5157
} catch (error) {
52-
console.log('Failed to add labels, they may not exist:', error);
58+
console.log('Failed to add label:', error);
5359
}
5460
55-
// 2. Add automated response comment
61+
// 2. Add an automated comment explaining the action
5662
await github.rest.issues.createComment({
5763
owner: context.repo.owner,
5864
repo: context.repo.repo,
5965
issue_number: context.issue.number,
6066
body: `---
61-
**🔍 Automated Detection Notice**
62-
63-
This issue has been automatically flagged due to detected keywords related to community guidelines.
67+
**⚠️ Content Blocked Notification**
6468

65-
The maintainer team focuses on keeping discussions centered around **technical development, feature implementation, and bug fixes**. Meta-discussions about project popularity metrics are noted and handled through appropriate channels.
69+
This issue has been automatically blocked because it contains restricted content. The project maintenance team only accepts technical discussions related to code development, feature implementation, and bug fixes.
6670

67-
**Next steps:**
68-
- This issue will be reviewed by maintainers
69-
- If content is duplicate or off-topic, the issue may be closed
70-
- Thank you for your understanding and cooperation
71+
According to our community guidelines, meta-discussions about project popularity, Star counts, or any form of artificial activity are not within the scope of this repository.
7172

72-
*This is an automated response*`
73+
*This action was performed by an automated system.*`
7374
});
7475

75-
// 3. 【Optional】Close issue immediately - uncomment below to enable
76-
/*
76+
// 3. Immediately close the issue
7777
await github.rest.issues.update({
7878
owner: context.repo.owner,
7979
repo: context.repo.repo,
8080
issue_number: context.issue.number,
8181
state: 'closed'
8282
});
83-
console.log('Issue closed automatically');
84-
*/
8583

86-
// 4. 【Optional】Lock issue - uncomment below to enable
87-
/*
84+
// 4. Lock the issue to prevent further comments
8885
await github.rest.issues.lock({
8986
owner: context.repo.owner,
9087
repo: context.repo.repo,
9188
issue_number: context.issue.number
9289
});
93-
console.log('Issue locked');
94-
*/
9590

91+
console.log('Issue has been closed and locked');
9692
} else {
97-
console.log('No sensitive content detected. Skipping processing.');
93+
console.log('No sensitive content detected, skipping processing');
9894
}

0 commit comments

Comments
 (0)