fix: update Claude issue workflow to use official anthropics/claude-code-action@beta

- Replace placeholder implementation with official Anthropic Claude Code action
- Update required secret from CLAUDE_API_KEY to CLAUDE_CODE_OAUTH_TOKEN
- Add id-token: write permission for Claude Code action
- Include allowed_tools for build, typecheck, lint, and test commands
- Update documentation with correct secret name and technical details

The workflow now uses the official Claude Code action for reliable,
production-ready issue implementations.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-18 21:02:20 +02:00
parent d09fe3054a
commit c083ae183c
2 changed files with 64 additions and 53 deletions

View File

@@ -24,7 +24,7 @@ When you trigger the automation:
1. **Permission Check**: Verifies you have write access to the repository
2. **Branch Creation**: Creates a new branch under `claude/issue-{number}-{timestamp}`
3. **Implementation**: Claude analyzes the issue and implements the requested changes
3. **Implementation**: Claude analyzes the issue and implements the requested changes using the official Anthropic Claude Code action
4. **Pull Request**: Automatically creates a PR with the implementation
5. **Notification**: Updates the issue with progress and results
@@ -44,7 +44,7 @@ claude/issue-{issue-number}-{timestamp}
#### Repository Setup
- The workflow must be merged into your default branch (usually `main` or `dev`)
- Required GitHub secrets:
- `CLAUDE_API_KEY` - Your Claude API key for implementation
- `CLAUDE_CODE_OAUTH_TOKEN` - Your Claude Code OAuth token for implementation
#### Issue Requirements
- Issue must be **open**
@@ -100,9 +100,11 @@ Please implement the PDF export feature as described in the issue. Make sure to
- Clear success/failure notifications
### ✅ Quality Assurance
- Uses official Anthropic Claude Code action
- Follows existing code patterns
- Includes appropriate documentation
- Maintains project coding standards
- Runs build, typecheck, and lint commands
## Troubleshooting
@@ -111,7 +113,8 @@ If the workflow fails:
1. Check the [Actions tab](../../actions) for detailed logs
2. Verify the issue has clear, actionable requirements
3. Ensure repository permissions are configured correctly
4. Try again with more specific requirements
4. Check that `CLAUDE_CODE_OAUTH_TOKEN` secret is set
5. Try again with more specific requirements
### No Changes Made
If Claude determines no changes are needed:
@@ -155,13 +158,38 @@ Add these secrets in repository settings:
| Secret | Description | Required |
|--------|-------------|----------|
| `CLAUDE_API_KEY` | Claude API key for implementation | Yes |
| `CLAUDE_CODE_OAUTH_TOKEN` | Claude Code OAuth token for implementation | Yes |
### Workflow Permissions
The workflow requires these permissions:
- `contents: write` - Create branches and commits
- `issues: write` - Comment on issues
- `pull-requests: write` - Create pull requests
- `id-token: write` - Required for Claude Code action
### Allowed Tools
Claude can run these commands during implementation:
- `pnpm build` - Build the project
- `pnpm typecheck` - Run TypeScript type checking
- `pnpm lint` - Run ESLint
- `npm run test` - Run tests
## Technical Details
### Claude Code Action
This workflow uses the official `anthropics/claude-code-action@beta` which provides:
- Direct integration with Claude's code generation capabilities
- Secure authentication via OAuth tokens
- Advanced code analysis and implementation features
- Built-in safety and quality controls
### Implementation Process
1. Claude analyzes the issue requirements
2. Reviews existing codebase patterns
3. Generates implementation following project conventions
4. Runs quality checks (build, typecheck, lint)
5. Creates commits with descriptive messages
6. Opens pull request with detailed description
## Limitations
@@ -177,8 +205,9 @@ If you encounter issues with the automation:
1. Check workflow logs in the Actions tab
2. Verify issue requirements are clear and actionable
3. Ensure you have proper repository permissions
4. Create a new issue describing the problem
4. Verify `CLAUDE_CODE_OAUTH_TOKEN` secret is configured
5. Create a new issue describing the problem
---
**Note**: This automation is powered by Claude AI and creates production-ready code, but all implementations should be reviewed before merging to ensure they meet your specific requirements and quality standards.
**Note**: This automation is powered by Anthropic's Claude Code action and creates production-ready code, but all implementations should be reviewed before merging to ensure they meet your specific requirements and quality standards.

View File

@@ -8,6 +8,7 @@ permissions:
contents: write
issues: write
pull-requests: write
id-token: write
jobs:
claude-implement:
@@ -89,59 +90,40 @@ jobs:
You can track the progress in the [Actions tab](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).`
});
- name: Install Claude Code CLI
run: |
# Install Claude Code CLI - adjust this based on available installation method
curl -fsSL https://claude.ai/install.sh | bash || echo "Claude CLI installation skipped - using alternative method"
- name: Prepare implementation context
id: context
run: |
# Create a context file with issue details
cat > implementation-context.md << 'EOF'
# Implementation Request
**Issue Number**: #${{ github.event.issue.number }}
**Issue Title**: ${{ github.event.issue.title }}
**Issue Body**:
${{ github.event.issue.body }}
**Comment Trigger**:
${{ github.event.comment.body }}
**Repository**: ${{ github.repository }}
**Branch**: ${{ steps.create-branch.outputs.branch_name }}
# Instructions
Please implement the feature or fix described in the issue above. Make sure to:
1. Follow the existing code patterns and conventions
2. Add appropriate tests if needed
3. Update documentation if necessary
4. Ensure the implementation is complete and working
5. Create a clear commit message describing the changes
The implementation should be production-ready and follow best practices.
EOF
- name: Implement with Claude
id: implementation
env:
CLAUDE_API_KEY: ${{ secrets.CLAUDE_API_KEY }}
run: |
# This is a placeholder for Claude implementation
# In practice, this would call Claude Code CLI or API
uses: anthropics/claude-code-action@beta
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
echo "Starting Claude implementation..."
# Direct prompt with issue context
direct_prompt: |
Please implement the feature or fix described in this GitHub issue:
# Simulate implementation work
# In real usage, this would use Claude Code CLI:
# claude-code --file implementation-context.md --implement
**Issue #${{ github.event.issue.number }}**: ${{ github.event.issue.title }}
# For now, create a placeholder implementation
echo "🤖 Claude implementation completed" > claude-implementation.log
**Issue Description**:
${{ github.event.issue.body }}
# Set output for next steps
echo "implemented=true" >> $GITHUB_OUTPUT
**Implementation Request**:
${{ github.event.comment.body }}
**Instructions**:
1. Analyze the issue requirements carefully
2. Follow the existing code patterns and conventions in this PayloadCMS plugin
3. Add appropriate tests if needed (check for existing test patterns)
4. Update documentation if necessary
5. Ensure the implementation is complete and working
6. Use TypeScript with proper typing
7. Follow the project's ESM module structure with .js extensions
The implementation should be production-ready and follow best practices for a PayloadCMS plugin.
**Repository Context**: This is the @xtr-dev/payload-billing plugin for PayloadCMS.
**Branch**: ${{ steps.create-branch.outputs.branch_name }}
# Allow Claude to run necessary commands
allowed_tools: "Bash(pnpm build),Bash(pnpm typecheck),Bash(pnpm lint),Bash(npm run test)"
- name: Check for changes
id: changes