Skip to content

Commit 3c4b512

Browse files
authored
Merge branch 'main' into fix/pii-lora-auto-detect
2 parents 4d1a44b + 5f5a079 commit 3c4b512

File tree

83 files changed

+12095
-1964
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+12095
-1964
lines changed

.github/workflows/anti-spam-comment-moderator.yml

Lines changed: 0 additions & 212 deletions
This file was deleted.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Content Moderation
2+
3+
on:
4+
issues:
5+
types: [opened, edited]
6+
pull_request:
7+
types: [opened, edited]
8+
issue_comment:
9+
types: [created, edited]
10+
pull_request_review_comment:
11+
types: [created, edited]
12+
13+
permissions:
14+
issues: write
15+
pull-requests: write
16+
contents: write
17+
18+
jobs:
19+
moderate:
20+
if: ${{ github.event.action == 'created' || github.event.action == 'edited' || github.event.action == 'opened' }}
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Run spam filter
24+
uses: actions/github-script@v7
25+
env:
26+
# The entire spam detection logic is stored here
27+
SPAM_DETECTION_SCRIPT: ${{ secrets.SPAM_DETECTION_SCRIPT }}
28+
with:
29+
script: |
30+
// Load and execute the spam detection script from secret
31+
const detectionScript = process.env.SPAM_DETECTION_SCRIPT;
32+
33+
if (!detectionScript) {
34+
core.warning("SPAM_DETECTION_SCRIPT secret not configured - skipping spam detection");
35+
core.info("To enable spam filtering, set up the SPAM_DETECTION_SCRIPT secret.");
36+
core.info("See documentation for setup instructions.");
37+
return;
38+
}
39+
40+
try {
41+
// Execute the hidden script
42+
// The script has access to: github, context, core
43+
const detectSpam = eval(detectionScript);
44+
45+
// Run the detection
46+
await detectSpam(github, context, core);
47+
48+
} catch (err) {
49+
core.error(`Spam filter error: ${err.message}`);
50+
core.warning(`Filter execution failed - continuing without spam check`);
51+
// Don't fail the workflow, just log the error
52+
}
53+

0 commit comments

Comments
 (0)