Skip to content

Commit 8cb0ce7

Browse files
Resolve conflict by deleting Mistral notebook
2 parents d50891d + 67e154d commit 8cb0ce7

File tree

93 files changed

+16377
-5871
lines changed

Some content is hidden

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

93 files changed

+16377
-5871
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: '[BUG] '
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
## Environment
10+
- Provider (select one):
11+
- [ ] Anthropic
12+
- [ ] OpenAI
13+
- [ ] Google Vertex AI
14+
- [ ] AWS Bedrock
15+
- [ ] Other: <!-- specify -->
16+
- PraisonAI version: <!-- if known -->
17+
- Operating System: <!-- e.g. macOS 14.3, Windows 11, Ubuntu 22.04 -->
18+
19+
## Full Code
20+
<!-- Full code that reproduces the bug -->
21+
22+
## Steps to Reproduce
23+
1. <!-- First step -->
24+
2. <!-- Second step -->
25+
3. <!-- And so on... -->
26+
27+
## Expected Behavior
28+
<!-- What you expected to happen -->
29+
30+
## Actual Behavior
31+
<!-- What actually happened -->
32+
33+
## Additional Context
34+
<!-- Add any other context about the problem here, such as screenshots, logs, etc. -->
Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
name: "Claude Code Action"
2+
description: "Run Claude Code in GitHub Actions workflows"
3+
4+
inputs:
5+
anthropic_api_key:
6+
description: "Anthropic API key"
7+
required: false
8+
github_token:
9+
description: "GitHub token for Claude to operate with"
10+
required: false
11+
default: ${{ github.token }}
12+
trigger_phrase:
13+
description: "The trigger phrase to look for in comments, issue/PR bodies, and issue titles"
14+
required: false
15+
default: "@claude"
16+
assignee_trigger:
17+
description: "The assignee username that triggers the action (e.g. @claude). Only used for issue assignment"
18+
required: false
19+
max_turns:
20+
description: "Maximum number of conversation turns Claude can take"
21+
required: false
22+
timeout_minutes:
23+
description: "Timeout in minutes for execution"
24+
required: false
25+
default: "30"
26+
model:
27+
description: "Model to use (provider-specific format required for Bedrock/Vertex)"
28+
required: false
29+
use_bedrock:
30+
description: "Use Amazon Bedrock with OIDC authentication instead of direct Anthropic API"
31+
required: false
32+
default: "false"
33+
use_vertex:
34+
description: "Use Google Vertex AI with OIDC authentication instead of direct Anthropic API"
35+
required: false
36+
default: "false"
37+
allowed_tools:
38+
description: "Additional tools for Claude to use (the base GitHub tools will always be included)"
39+
required: false
40+
default: ""
41+
disallowed_tools:
42+
description: "Tools that Claude should never use"
43+
required: false
44+
default: ""
45+
custom_instructions:
46+
description: "Additional custom instructions to include in the prompt for Claude"
47+
required: false
48+
default: ""
49+
mcp_config:
50+
description: "Additional MCP configuration (JSON string) that merges with the built-in GitHub MCP servers"
51+
required: false
52+
default: ""
53+
claude_env:
54+
description: "Custom environment variables to pass to Claude Code execution (YAML format)"
55+
required: false
56+
default: ""
57+
direct_prompt:
58+
description: "Direct prompt for Claude to execute automatically without needing a trigger (for automated workflows)"
59+
required: false
60+
61+
runs:
62+
using: "composite"
63+
steps:
64+
- name: Install Claude Code
65+
shell: bash
66+
run: npm install -g @anthropic-ai/claude-code
67+
68+
- name: Install GitHub MCP Server
69+
shell: bash
70+
run: |
71+
claude mcp add-json github '{
72+
"command": "docker",
73+
"args": [
74+
"run",
75+
"-i",
76+
"--rm",
77+
"-e",
78+
"GITHUB_PERSONAL_ACCESS_TOKEN",
79+
"ghcr.io/github/github-mcp-server:sha-ff3036d"
80+
],
81+
"env": {
82+
"GITHUB_PERSONAL_ACCESS_TOKEN": "${{ inputs.github_token }}"
83+
}
84+
}'
85+
86+
- name: Extract GitHub Context and Create Prompt
87+
shell: bash
88+
id: prepare_context
89+
run: |
90+
echo "🔍 Extracting GitHub context from event: ${{ github.event_name }}"
91+
92+
# Function to check for trigger phrase
93+
check_trigger() {
94+
local text="$1"
95+
local trigger="${{ inputs.trigger_phrase }}"
96+
if [[ "$text" == *"$trigger"* ]]; then
97+
return 0
98+
fi
99+
return 1
100+
}
101+
102+
# Extract context based on event type
103+
TRIGGER_FOUND="false"
104+
USER_REQUEST=""
105+
CONTEXT_INFO=""
106+
107+
case "${{ github.event_name }}" in
108+
"issue_comment")
109+
COMMENT_BODY="${{ github.event.comment.body }}"
110+
ISSUE_TITLE="${{ github.event.issue.title }}"
111+
ISSUE_NUMBER="${{ github.event.issue.number }}"
112+
113+
if check_trigger "$COMMENT_BODY"; then
114+
TRIGGER_FOUND="true"
115+
USER_REQUEST="$COMMENT_BODY"
116+
CONTEXT_INFO="Issue Comment on #$ISSUE_NUMBER: $ISSUE_TITLE"
117+
fi
118+
;;
119+
120+
"pull_request_review_comment")
121+
COMMENT_BODY="${{ github.event.comment.body }}"
122+
PR_TITLE="${{ github.event.pull_request.title }}"
123+
PR_NUMBER="${{ github.event.pull_request.number }}"
124+
125+
if check_trigger "$COMMENT_BODY"; then
126+
TRIGGER_FOUND="true"
127+
USER_REQUEST="$COMMENT_BODY"
128+
CONTEXT_INFO="PR Comment on #$PR_NUMBER: $PR_TITLE"
129+
fi
130+
;;
131+
132+
"pull_request_review")
133+
REVIEW_BODY="${{ github.event.review.body }}"
134+
PR_TITLE="${{ github.event.pull_request.title }}"
135+
PR_NUMBER="${{ github.event.pull_request.number }}"
136+
137+
if check_trigger "$REVIEW_BODY"; then
138+
TRIGGER_FOUND="true"
139+
USER_REQUEST="$REVIEW_BODY"
140+
CONTEXT_INFO="PR Review on #$PR_NUMBER: $PR_TITLE"
141+
fi
142+
;;
143+
144+
"issues")
145+
ISSUE_BODY="${{ github.event.issue.body }}"
146+
ISSUE_TITLE="${{ github.event.issue.title }}"
147+
ISSUE_NUMBER="${{ github.event.issue.number }}"
148+
149+
if check_trigger "$ISSUE_TITLE" || check_trigger "$ISSUE_BODY"; then
150+
TRIGGER_FOUND="true"
151+
USER_REQUEST="$ISSUE_BODY"
152+
CONTEXT_INFO="Issue #$ISSUE_NUMBER: $ISSUE_TITLE"
153+
elif [[ "${{ github.event.action }}" == "assigned" && -n "${{ inputs.assignee_trigger }}" ]]; then
154+
ASSIGNEE="${{ github.event.assignee.login }}"
155+
if [[ "$ASSIGNEE" == "${{ inputs.assignee_trigger }}" ]]; then
156+
TRIGGER_FOUND="true"
157+
USER_REQUEST="$ISSUE_BODY"
158+
CONTEXT_INFO="Issue #$ISSUE_NUMBER assigned to $ASSIGNEE: $ISSUE_TITLE"
159+
fi
160+
fi
161+
;;
162+
esac
163+
164+
# Check for direct prompt override
165+
if [[ -n "${{ inputs.direct_prompt }}" ]]; then
166+
TRIGGER_FOUND="true"
167+
USER_REQUEST="${{ inputs.direct_prompt }}"
168+
CONTEXT_INFO="Automated GitHub workflow"
169+
fi
170+
171+
if [[ "$TRIGGER_FOUND" != "true" ]]; then
172+
echo "❌ No trigger phrase found or direct prompt provided. Exiting gracefully."
173+
echo "SKIP_EXECUTION=true" >> $GITHUB_ENV
174+
exit 0
175+
fi
176+
177+
echo "✅ Trigger found! Context: $CONTEXT_INFO"
178+
179+
# Create comprehensive prompt
180+
mkdir -p /tmp/claude-action
181+
cat > /tmp/claude-action/github-context-prompt.txt << EOF
182+
You are Claude Code, an AI assistant helping with GitHub workflows and code.
183+
184+
Repository: ${{ github.repository }}
185+
Context: $CONTEXT_INFO
186+
Event: ${{ github.event_name }}
187+
188+
User Request:
189+
$USER_REQUEST
190+
191+
Please analyze the request and provide helpful assistance. You have access to repository tools and can help with:
192+
- Code analysis and implementation
193+
- GitHub workflows and automation
194+
- Pull request reviews and feedback
195+
- Issue resolution and bug fixes
196+
- Documentation updates
197+
- Testing and deployment
198+
199+
Respond naturally and helpfully to the user's request using the available tools.
200+
EOF
201+
202+
echo "PROMPT_FILE=/tmp/claude-action/github-context-prompt.txt" >> $GITHUB_ENV
203+
echo "SKIP_EXECUTION=false" >> $GITHUB_ENV
204+
205+
- name: Run Claude Code
206+
if: env.SKIP_EXECUTION != 'true'
207+
shell: bash
208+
run: |
209+
echo "🚀 Running Claude Code with GitHub context..."
210+
211+
# Build command arguments
212+
CMD_ARGS=("-p" "--verbose" "--output-format" "stream-json")
213+
214+
# Add max turns if specified
215+
if [[ -n "${{ inputs.max_turns }}" ]]; then
216+
CMD_ARGS+=("--max-turns" "${{ inputs.max_turns }}")
217+
fi
218+
219+
# Add allowed tools (include GitHub tools by default)
220+
TOOLS="mcp__github__get_issue,mcp__github__get_issue_comments,mcp__github__update_issue,mcp__github__search_issues,mcp__github__list_issues,mcp__github__create_comment,Read,Write,Edit,Bash"
221+
if [[ -n "${{ inputs.allowed_tools }}" ]]; then
222+
TOOLS="$TOOLS,${{ inputs.allowed_tools }}"
223+
fi
224+
CMD_ARGS+=("--allowedTools" "$TOOLS")
225+
226+
# Add disallowed tools
227+
if [[ -n "${{ inputs.disallowed_tools }}" ]]; then
228+
CMD_ARGS+=("--disallowedTools" "${{ inputs.disallowed_tools }}")
229+
fi
230+
231+
echo "📝 Executing Claude Code with prompt from file..."
232+
233+
# Execute Claude Code with timeout, using stdin for the prompt
234+
TIMEOUT_SECONDS=$((${{ inputs.timeout_minutes }} * 60))
235+
timeout $TIMEOUT_SECONDS claude "${CMD_ARGS[@]}" < "${{ env.PROMPT_FILE }}"
236+
237+
echo "✅ Claude Code execution completed"
238+
env:
239+
ANTHROPIC_API_KEY: ${{ inputs.anthropic_api_key }}
240+
GITHUB_TOKEN: ${{ inputs.github_token }}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: "Claude Issue Triage Action"
2+
description: "Automatically triage GitHub issues using Claude Code"
3+
4+
inputs:
5+
timeout_minutes:
6+
description: "Timeout in minutes for execution"
7+
required: false
8+
default: "5"
9+
anthropic_api_key:
10+
description: "Anthropic API key"
11+
required: true
12+
github_token:
13+
description: "GitHub token with repo and issues permissions"
14+
required: true
15+
16+
runs:
17+
using: "composite"
18+
steps:
19+
- name: Checkout repository code
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Create prompt file
25+
shell: bash
26+
run: |
27+
mkdir -p /tmp/claude-prompts
28+
cat > /tmp/claude-prompts/claude-issue-triage-prompt.txt << 'EOF'
29+
You're an issue triage assistant for GitHub issues. Your task is to analyze the issue and select appropriate labels from the provided list.
30+
31+
IMPORTANT: Don't post any comments or messages to the issue. Your only action should be to apply labels.
32+
33+
Issue Information:
34+
- REPO: ${{ github.repository }}
35+
- ISSUE_NUMBER: ${{ github.event.issue.number }}
36+
37+
TASK OVERVIEW:
38+
39+
1. First, fetch the list of labels available in this repository by running: `gh label list`. Run exactly this command with nothing else.
40+
41+
2. Next, use the GitHub tools to get context about the issue:
42+
- You have access to these tools:
43+
- mcp__github__get_issue: Use this to retrieve the current issue's details including title, description, and existing labels
44+
- mcp__github__get_issue_comments: Use this to read any discussion or additional context provided in the comments
45+
- mcp__github__update_issue: Use this to apply labels to the issue (do not use this for commenting)
46+
- mcp__github__search_issues: Use this to find similar issues that might provide context for proper categorization and to identify potential duplicate issues
47+
- mcp__github__list_issues: Use this to understand patterns in how other issues are labeled
48+
- Start by using mcp__github__get_issue to get the issue details
49+
50+
3. Analyze the issue content, considering:
51+
- The issue title and description
52+
- The type of issue (bug report, feature request, question, etc.)
53+
- Technical areas mentioned
54+
- Severity or priority indicators
55+
- User impact
56+
- Components affected
57+
58+
4. Select appropriate labels from the available labels list provided above:
59+
- Choose labels that accurately reflect the issue's nature
60+
- Be specific but comprehensive
61+
- Select priority labels if you can determine urgency (high-priority, med-priority, or low-priority)
62+
- Consider platform labels (android, ios) if applicable
63+
- If you find similar issues using mcp__github__search_issues, consider using a "duplicate" label if appropriate. Only do so if the issue is a duplicate of another OPEN issue.
64+
65+
5. Apply the selected labels:
66+
- Use mcp__github__update_issue to apply your selected labels
67+
- DO NOT post any comments explaining your decision
68+
- DO NOT communicate directly with users
69+
- If no labels are clearly applicable, do not apply any labels
70+
71+
IMPORTANT GUIDELINES:
72+
- Be thorough in your analysis
73+
- Only select labels from the provided list above
74+
- DO NOT post any comments to the issue
75+
- Your ONLY action should be to apply labels using mcp__github__update_issue
76+
- It's okay to not add any labels if none are clearly applicable
77+
EOF
78+
79+
- name: Run Claude Code
80+
uses: ./.github/actions/claude-code-action
81+
with:
82+
prompt_file: /tmp/claude-prompts/claude-issue-triage-prompt.txt
83+
allowed_tools: "Bash(gh label list),mcp__github__get_issue,mcp__github__get_issue_comments,mcp__github__update_issue,mcp__github__search_issues,mcp__github__list_issues"
84+
install_github_mcp: "true"
85+
timeout_minutes: ${{ inputs.timeout_minutes }}
86+
anthropic_api_key: ${{ inputs.anthropic_api_key }}
87+
github_token: ${{ inputs.github_token }}

0 commit comments

Comments
 (0)