Skip to content

Commit db13493

Browse files
authored
chore: add GitHub Actions workflows for community management (#2022)
- Add AI Moderator workflow for spam and AI content detection - Add Welcome New Contributors workflow for first-time contributors - Configure necessary permissions and triggers for both workflows
1 parent 7d17984 commit db13493

2 files changed

Lines changed: 70 additions & 0 deletions

File tree

.github/workflows/moderator.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: AI Moderator
2+
on:
3+
issues:
4+
types: [opened]
5+
issue_comment:
6+
types: [created]
7+
pull_request_review_comment:
8+
types: [created]
9+
10+
jobs:
11+
spam-detection:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
issues: write
15+
pull-requests: write
16+
models: read
17+
contents: read
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: github/ai-moderator@v1
21+
with:
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
spam-label: 'spam'
24+
ai-label: 'ai-generated'
25+
minimize-detected-comments: true
26+
# Built-in prompt configuration (all enabled by default)
27+
enable-spam-detection: true
28+
enable-link-spam-detection: true
29+
enable-ai-detection: true
30+
# custom-prompt-path: '.github/prompts/my-custom.prompt.yml' # Optional
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Welcome New Contributors
2+
3+
on:
4+
pull_request:
5+
types: [opened]
6+
7+
permissions:
8+
pull-requests: write
9+
models: read
10+
11+
jobs:
12+
welcome:
13+
runs-on: ubuntu-latest
14+
if: github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
15+
steps:
16+
- name: Generate welcome message
17+
uses: actions/ai-inference@v1
18+
id: ai
19+
with:
20+
prompt: |
21+
Write a friendly welcome message for a first-time contributor. Include:
22+
1. Thank them for their first PR
23+
2. Mention checking CONTRIBUTING.md
24+
3. Offer to help if they have questions
25+
26+
Keep it brief and encouraging.
27+
model: openai/gpt-4o-mini
28+
temperature: 0.7
29+
30+
- name: Post welcome comment
31+
uses: actions/github-script@v7
32+
with:
33+
script: |
34+
const message = `${{ steps.ai.outputs.response }}`;
35+
await github.rest.issues.createComment({
36+
owner: context.repo.owner,
37+
repo: context.repo.repo,
38+
issue_number: ${{ github.event.pull_request.number }},
39+
body: message
40+
});

0 commit comments

Comments
 (0)