-
Notifications
You must be signed in to change notification settings - Fork 8
222 lines (202 loc) Β· 10.2 KB
/
Copy pathclaude.yml
File metadata and controls
222 lines (202 loc) Β· 10.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
name: Claude Assistant
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [assigned, labeled, opened]
pull_request_review:
types: [submitted]
jobs:
# ================================================================
# Job 1: Lightweight triage for ALL new issues (including external users)
# Posts welcome comment + adds triage labels. No Claude code execution.
# ================================================================
issue-triage:
if: |
github.event_name == 'issues' &&
github.event.action == 'opened' &&
!contains(toJSON(github.event.issue.labels), 'claude')
runs-on: ubuntu-latest
permissions:
issues: write
contents: read
steps:
- name: Triage and acknowledge issue
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const issue = context.payload.issue;
const title = (issue.title || '').toLowerCase();
const body = (issue.body || '').toLowerCase();
const content = title + ' ' + body;
const isOwner = ['OWNER', 'MEMBER', 'COLLABORATOR'].includes(
issue.author_association
);
// --- Label triage ---
const labels = [];
// Kind labels
if (content.includes('feature request') || content.includes('[feature')) {
labels.push('enhancement');
} else if (content.includes('bug') || content.includes('error') || content.includes('crash') || content.includes('traceback')) {
labels.push('bug');
} else if (content.includes('question') || content.includes('how do i') || content.includes('how to')) {
labels.push('question');
}
// Area labels
if (content.includes('security') || content.includes('cve') || content.includes('vulnerability')) {
labels.push('security');
}
if (content.includes('performance') || content.includes('slow') || content.includes('memory leak')) {
labels.push('performance');
}
if (content.includes('documentation') || content.includes('docs')) {
labels.push('documentation');
}
if (content.includes('typescript') || content.includes('javascript') || content.includes('npm')) {
labels.push('javascript');
}
// Apply labels
if (labels.length > 0) {
await github.rest.issues.addLabels({
issue_number: issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels
});
}
// --- Acknowledgment comment (external users only) ---
if (!isOwner) {
await github.rest.issues.createComment({
issue_number: issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: [
`π Thanks for opening this issue, @${issue.user.login}!`,
'',
'A maintainer will review this shortly. In the meantime:',
'- Make sure you\'ve included steps to reproduce (for bugs)',
`- Check [existing issues](https://github.com/${context.repo.owner}/${context.repo.repo}/issues) for duplicates`,
'- Review the [documentation](https://docs.praison.ai) for related guides',
].join('\n')
});
}
// Claude label: added by .github/workflows/auto-issue-comment.yml on issues:opened
// (do not add 'claude' here β avoids duplicate labeled events and double Claude runs)
# ================================================================
# Job 2: Full Claude docs-fix
# Triggers on: issues labeled `claude`, @claude issue comments, PR review threads, PR reviews
# ================================================================
claude-response:
# Runs on: issues labeled "claude", @claude comments, PR review comments, PR reviews β not on opened/assigned/other labels
env:
ISSUE_NUMBER_RESOLVED: ${{ github.event.issue.number || github.event.pull_request.number }}
if: |
github.event.action != 'opened' &&
(github.event_name != 'issues' || (github.event.action == 'labeled' && github.event.label.name == 'claude')) &&
(github.event_name != 'issue_comment' || contains(github.event.comment.body, '@claude')) &&
(
!contains(github.actor, '[bot]') ||
github.actor == 'github-actions[bot]' ||
github.actor == 'praisonai-triage-agent[bot]'
) &&
github.actor != 'dependabot[bot]' &&
github.actor != 'cursor[bot]' &&
github.actor != 'renovate[bot]'
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: write
actions: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}
- uses: anthropics/claude-code-action@beta
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
with:
allowed_bots: 'praisonai-triage-agent[bot]'
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
github_token: ${{ secrets.GH_TOKEN }}
anthropic_model: claude-sonnet-4-6
trigger_phrase: "@claude"
label_trigger: "claude"
direct_prompt: |
You are a documentation engineer for PraisonAI. This is a DOCUMENTATION repository.
Follow AGENTS.md strictly β it contains the exact page structure, Mintlify components,
Mermaid diagram standards, and code example rules you MUST follow.
STEP 0 β SETUP GIT IDENTITY & AUTH:
git config --global user.name "MervinPraison"
git config --global user.email "454862+MervinPraison@users.noreply.github.com"
gh auth setup-git
STEP 1 β READ AGENTS.md:
Read AGENTS.md completely. It defines:
- Page structure template (Section 2)
- Mermaid diagram color scheme: #8B0000 dark red, #189AB4 teal, #fff white text (Section 3)
- Mintlify components: Steps, AccordionGroup, CardGroup, Tabs, CodeGroup (Section 4)
- Code example standards: copy-paste runnable, minimal, agent-centric (Section 5)
- Writing style: concise, active voice, no forbidden phrases (Section 6)
- Quality checklist (Section 9)
Every documentation page you create MUST pass the quality checklist.
STEP 2 β UNDERSTAND THE ISSUE:
Read the issue title, body, and all comments carefully.
Determine what documentation needs to be created or updated.
STEP 3 β READ SDK SOURCE:
Read `./praisonaiagents/` and `./praisonai/` first (AGENTS.md Β§1.4). Extract signatures,
defaults, feature_configs.py, imports. If missing, clone: gh repo clone MervinPraison/PraisonAI /tmp/PraisonAI --depth=1
NEVER guess β read the code.
FOLDER RULES (CRITICAL β NEVER VIOLATE):
- NEVER create or modify pages in docs/concepts/ β that folder is HUMAN-APPROVED ONLY
- Always place new documentation pages in docs/features/ instead
- If the issue mentions "concepts", still place the file in docs/features/
- Update docs.json to add new pages under the "Features" group, NOT "Concepts"
- Existing docs/concepts/ pages must NOT be touched without explicit human approval
STEP 4 β CREATE DOCUMENTATION:
- Create one feature branch and reuse its name in STEP 7, e.g. BRANCH="claude/issue-${{ env.ISSUE_NUMBER_RESOLVED }}-$(date +%Y%m%d)" then git checkout -b "$BRANCH"
- Place ALL new .mdx files in docs/features/ (NEVER docs/concepts/)
- Follow the page structure template in AGENTS.md Section 2
- Start every page with an agent-centric Quick Start example
- Use Mintlify components (Steps, AccordionGroup, CardGroup, Tabs)
- Include Mermaid diagrams with the standard color scheme
- All code examples must be copy-paste runnable with correct imports
- User-friendly: non-developers and beginners should understand
- Progressive disclosure: simple first, advanced later
STEP 5 β UPDATE NAVIGATION:
If creating new pages, add them to docs.json in the correct section.
Check existing structure in docs.json to find the right group.
STEP 6 β VERIFY:
- Confirm all .mdx files exist and are valid
- Verify docs.json is valid JSON
- Check all code examples have correct imports
- Ensure Mermaid diagrams use the standard color scheme
STEP 7 β COMMIT, PUSH, OPEN PR (mandatory end state):
- git add -A && git commit -m "docs: <description> (fixes #${{ env.ISSUE_NUMBER_RESOLVED }})"
- git push -u origin "$BRANCH" # same $BRANCH as STEP 4; never use a second $(date ...) for the branch name
- gh pr create --base main --head "$BRANCH" --title "docs: <title>" --body "Fixes #${{ env.ISSUE_NUMBER_RESOLVED }}"
Opening the PR is required for every run that produced commits. Do not finish after push only, do not ask a human to open a PR, and do not stop for a "summary" until `gh pr create` returns a PR URL. If `gh pr create` fails, read the error, fix (e.g. auth, duplicate PR, wrong head), and retry until it succeeds.
allowed_tools: |
Bash(git:*)
Bash(python:*)
Bash(pip:*)
Bash(conda:*)
Bash(pytest:*)
Bash(gh:*)
Bash(python -m pytest:*)
Bash(python -m pip:*)
Bash(poetry:*)
View
GlobTool
GrepTool
BatchTool
Edit
Replace
mcp__github__get_issue
mcp__github__get_issue_comments
mcp__github__update_issue
timeout_minutes: 30