Skip to content

Commit

Permalink
Add GH actions for spam & issue assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
akegaviar committed Jan 7, 2025
1 parent 5287d7e commit d7768b5
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 0 deletions.
Empty file.
80 changes: 80 additions & 0 deletions .github/workflows/spam-detection.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Suspicious Comment Detection

on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]

jobs:
check_comment:
runs-on: ubuntu-latest
steps:
- name: Check for suspicious patterns
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const comment = context.payload.comment;
const body = comment.body.toLowerCase();
const author = comment.user.login;
// Suspicious patterns
const suspiciousPatterns = [
'support team',
'customer service',
'telegram',
'whatsapp',
'contact us',
'click here',
'support group',
't.me/',
'wa.me/',
'support chat',
'live chat',
'support ticket',
'ticket id',
'live support',
'support line',
'support agent',
'support network',
'dedicated support',
'personalized assistance',
'opened for you',
'kindly talk to',
'we apologize',
];
// Check for external links (excluding common legitimate domains)
const hasExternalLinks = body.includes('http') || body.includes('www');
const hasGithubLinks = body.includes('github.com');
const suspiciousLinks = hasExternalLinks && !hasGithubLinks;
// Check for suspicious patterns
const foundPatterns = suspiciousPatterns.filter(pattern =>
body.includes(pattern)
);
if (foundPatterns.length > 0 || suspiciousLinks) {
// Create a warning comment
const warningMessage = `⚠️ Potential scam detected in comment by ${author}:
- Suspicious patterns found: ${foundPatterns.join(', ')}
${suspiciousLinks ? '- Contains external links' : ''}
@${context.repo.owner} Please review this comment.`;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue ? context.payload.issue.number : context.payload.pull_request.number,
body: warningMessage
});
// Add 'potential-scam' label
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.issue ? context.payload.issue.number : context.payload.pull_request.number,
labels: ['potential-scam']
});
}
3 changes: 3 additions & 0 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The maintainers are:
@akegaviar (primary contact, issue manager)
@smypmsa
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
**WARNNING ON SCAMS IN ISSUES COMMENT SECTION**
The issues comment section is often targeted by scam bots willing to redirect you to an external resource and drain your funds.

I have enabled a GitHub actions script to detect the common patterns and tag them, which obviously is not 100% accurate.

The official maintainers are in the [MAINTAINERS.md](MAINTAINERS.md) file.

Not everyone is a scammer though, sometimes there are helpful outside devs who comment and I absolutely appreciate it.

**END OF WARNING**

For the full walkthrough, see [Solana: Creating a trading and sniping pump.fun bot](https://docs.chainstack.com/docs/solana-creating-a-pumpfun-bot).

For near-instantaneous transaction propagation, you can use the [Chainstack Solana Trader nodes](https://docs.chainstack.com/docs/trader-nodes).
Expand Down

0 comments on commit d7768b5

Please sign in to comment.