Skip to content

ci: Add Claude Code GitHub Workflow - #6

Merged
edenreich merged 3 commits into
mainfrom
add-claude-github-actions-1753657383818
Jul 27, 2025
Merged

edenreich merged 3 commits into
mainfrom
add-claude-github-actions-1753657383818

Conversation

@edenreich

Copy link
Copy Markdown
Contributor

🤖 Installing Claude Code GitHub App

This PR adds a GitHub Actions workflow that enables Claude Code integration in our repository.

What is Claude Code?

Claude Code is an AI coding agent that can help with:

  • Bug fixes and improvements
  • Documentation updates
  • Implementing new features
  • Code reviews and suggestions
  • Writing tests
  • And more!

How it works

Once this PR is merged, we'll be able to interact with Claude by mentioning @claude in a pull request or issue comment.
Once the workflow is triggered, Claude will analyze the comment and surrounding context, and execute on the request in a GitHub action.

Important Notes

  • This workflow won't take effect until this PR is merged
  • @claude mentions won't work until after the merge is complete
  • The workflow runs automatically whenever Claude is mentioned in PR or issue comments
  • Claude gets access to the entire PR or issue context including files, diffs, and previous comments

Security

  • Our Anthropic API key is securely stored as a GitHub Actions secret
  • Only users with write access to the repository can trigger the workflow
  • All Claude runs are stored in the GitHub Actions run history
  • Claude's default tools are limited to reading/writing files and interacting with our repo by creating comments, branches, and commits.
  • We can add more allowed tools by adding them to the workflow file like:
allowed_tools: Bash(npm install),Bash(npm run build),Bash(npm run lint),Bash(npm run test)

There's more information in the Claude Code action repo.

After merging this PR, let's try mentioning @claude in a comment on any PR to get started!

@claude

claude Bot commented Jul 27, 2025 •

Copy link
Copy Markdown
Contributor

Claude finished @edenreich's task —— View job


Code Review: Claude Code GitHub Workflows

I've analyzed both workflow files and here's my comprehensive review:

Overall Assessment

  • Read and analyze workflow files
  • Check code quality and best practices
  • Review security considerations
  • Evaluate performance implications
  • Check integration with project requirements

✅ Strengths

Code Quality & Best Practices:

  • Both workflows use proper GitHub Actions YAML syntax
  • Good use of comments and documentation throughout
  • Proper conditional logic in claude.yml to prevent unnecessary runs
  • Uses latest actions/checkout@v4
  • Appropriate permission scoping (read-only with minimal write access)

Security:

  • Secrets properly handled via ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
  • Permissions are appropriately scoped and minimal
  • No hardcoded credentials or sensitive data exposed
  • Proper use of id-token: write for OIDC authentication

Workflow Design:

  • claude-code-review.yml: Clean automated review setup for PRs
  • claude.yml: Comprehensive trigger conditions covering comments, reviews, and issue events
  • Good separation of concerns between automated reviews and interactive assistance

🔧 Areas for Improvement

1. Missing Project-Specific Tool Configuration
Both workflows lack allowed_tools configuration. Based on your CLAUDE.md, Claude should be able to run:

allowed_tools: "Bash(npm run lint),Bash(npm run format:check),Bash(npm run build),Bash(npm run prebuild)"

2. Git History Limitations
.github/workflows/claude-code-review.yml:32 - fetch-depth: 1 may limit review quality for complex changes requiring git history context.

3. Missing Custom Instructions
Consider adding project-specific guidance in claude.yml:

custom_instructions: |
  - Always run `npm run lint` and `npm run format:check` before committing
  - This is a documentation-only repository for Inference Gateway
  - Content is in MDX format in /markdown/ directory
  - Follow Next.js and TypeScript best practices

4. No Sticky Comments
claude-code-review.yml:55 - Consider enabling sticky comments to reduce comment clutter on PR updates.

5. File Path Filtering
For performance, consider uncommenting and customizing the paths filter in claude-code-review.yml:6-11 to target relevant files.


📋 Recommendations

High Priority:

  1. Add allowed_tools configuration to enable Claude to run linting and build commands
  2. Add custom_instructions to guide Claude with project-specific requirements

Medium Priority:
3. Enable sticky comments in automated reviews
4. Consider increasing fetch-depth to 0 or 50 for better review context
5. Add file path filtering for automated reviews

Low Priority:
6. Add test-related tools when test suite is implemented
7. Consider environment variables for different deployment contexts


🛡️ Security Considerations

  • ✅ Proper secret management
  • ✅ Minimal required permissions
  • ✅ No security vulnerabilities identified
  • ℹ️ Consider repository write access controls for Claude mentions

Performance & Test Coverage

  • ✅ Efficient with fetch-depth: 1 and conditional execution
  • ⚠️ No test coverage integration visible (add when tests are implemented)
  • ✅ No performance bottlenecks identified

These workflows provide a solid foundation for Claude Code integration. The main enhancement needed is project-specific tool configuration to leverage your existing lint/build commands.

@edenreich edenreich changed the title Add Claude Code GitHub Workflow ci: Add Claude Code GitHub Workflow Jul 27, 2025
… issue comments and enhance permissions

Signed-off-by: Eden Reich <[email protected]>
@edenreich
edenreich merged commit 9161a09 into main Jul 27, 2025
@edenreich
edenreich deleted the add-claude-github-actions-1753657383818 branch July 27, 2025 23:06
github-actions Bot pushed a commit that referenced this pull request Jul 28, 2025
## [0.4.9](0.4.8...0.4.9) (2025-07-28)

### 👷 CI

* Add Claude Code GitHub Workflow ([#6](#6)) ([9161a09](9161a09))

### 📚 Documentation

* Add CLAUDE.md for project overview, architecture, development commands, and content management ([44c454d](44c454d))
* Update environment variables and version references ([#8](#8)) ([e9a69cf](e9a69cf))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant