Skip to content

Commit 098bf96

Browse files
Merge pull request #27 from EightfoldAI/test_code_impl
Add workflow for automated code implementation
2 parents c298f7a + 31e6190 commit 098bf96

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Code Implementation via Claude
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
summary:
7+
description: 'Summary of changes to make'
8+
required: true
9+
type: string
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
actions: read
14+
id-token: write
15+
16+
jobs:
17+
auto-changes:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Create feature branch
26+
id: branch
27+
run: |
28+
BRANCH_NAME="claude-changes-${{ github.run_id }}"
29+
git checkout -b "$BRANCH_NAME"
30+
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
31+
32+
- name: Make changes with Claude
33+
id: claude
34+
uses: anthropics/claude-code-action@v1
35+
with:
36+
prompt: |
37+
You are an AI assistant helping to make changes to a repository and create a Pull Request.
38+
39+
IMPORTANT: You must complete ALL the following tasks:
40+
41+
Task Summary:
42+
${{ github.event.inputs.summary }}
43+
44+
YOUR TASKS:
45+
1. Analyze the repository and make all necessary changes according to the summary
46+
2. Review all changes you've made
47+
3. Commit the changes to the git branch with an appropriate commit message
48+
4. Push the branch to the remote repository
49+
5. Create a Pull Request with a detailed summary and description
50+
51+
DETAILED INSTRUCTIONS:
52+
53+
**Step 1-2: Make Changes**
54+
- Examine the current repository structure first
55+
- Make all necessary file modifications
56+
- Ensure changes are consistent with the existing codebase style
57+
- Create or modify files as needed
58+
59+
**Step 3: Commit Changes**
60+
- Use: git add -A
61+
- Use: git commit -m "chore: [descriptive message based on changes]"
62+
- Include a detailed commit message explaining what was changed
63+
64+
**Step 4: Push to Remote**
65+
- Use: git push origin ${{ steps.branch.outputs.branch_name }}
66+
67+
**Step 5: Create Pull Request**
68+
- Use the GitHub CLI (gh pr create) to create a PR with:
69+
- Title: A clear, concise title describing the changes
70+
- Body: A detailed PR summary including:
71+
* What was changed and why
72+
* List of files modified
73+
* Any important notes or considerations
74+
* Reference to the original task
75+
- Example: gh pr create --title "Add TypeScript types" --body "This PR adds TypeScript types to all API endpoints..." --base main
76+
77+
Guidelines:
78+
- Be thorough and complete all tasks in order
79+
- The PR body should be well-structured and informative
80+
- Include all relevant context in the PR description
81+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
82+
- Do not make any changes to master branch
83+
claude_args: "--allowedTools 'Edit,MultiEdit,Write,Read,Glob,Grep,LS,Bash(git:*),Bash(bun:*),Bash(npm:*),Bash(npx:*),Bash(gh:*)'"
84+
85+
- name: Verify PR Creation
86+
run: |
87+
echo "✅ Claude has completed all tasks:"
88+
echo " - Made changes to the repository"
89+
echo " - Committed changes to branch: ${{ steps.branch.outputs.branch_name }}"
90+
echo " - Pushed branch to remote"
91+
echo " - Created Pull Request with detailed summary"
92+
echo ""
93+
echo "Original Task: ${{ github.event.inputs.summary }}"

0 commit comments

Comments
 (0)