Skip to content

chore: add and adjust README files #27

chore: add and adjust README files

chore: add and adjust README files #27

name: Claude Code
on:
pull_request:
types: [opened, reopened, synchronize]
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]
jobs:
claude:
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@main
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
code_review:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Authenticate GitHub CLI
run: gh auth setup-git
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Delete Claude comments
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
REPO: ${{ github.repository }}
run: |
echo "Fetching comments from PR $PR_NUMBER in $REPO"
ids=$(gh api "/repos/$REPO/issues/$PR_NUMBER/comments" --jq '.[] | select(.user.login | test("claude"; "i")) | .id')
ids2=$(gh api "/repos/$REPO/pulls/$PR_NUMBER/comments" --jq '.[] | select(.user.login | test("claude"; "i")) | .id')
# Count non-empty lines
count=0
if [ -n "$ids" ]; then
count=$(echo "$ids" | grep -c '^')
fi
echo "Found $count Claude comments to delete"
echo "$ids" | while read -r id; do
[ -n "$id" ] && {
echo "Removing issues/comments/ ID: $id"
if ! gh api --method DELETE "/repos/$REPO/issues/comments/$id" --silent; then
echo "Warning: Failed to delete comment ID: $id" >&2
fi
}
done
count2=0
if [ -n "$ids2" ]; then
count2=$(echo "$ids2" | grep -c '^')
fi
echo "Found $count2 Claude comments to delete"
echo "$ids2" | while read -r id; do
[ -n "$id" ] && {
echo "Removing pulls/comments/ ID: $id"
if ! gh api --method DELETE "/repos/$REPO/pulls/comments/$id" --silent; then
echo "Warning: Failed to delete comment ID: $id" >&2
fi
}
done
echo "Script completed successfully"
exit 0
- name: Run Claude Code
id: claude
uses: valorkin/claude-code-action@feat-limit-amount-of-claude-comments
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
model: claude-sonnet-4-20250514
comments_max: 2
allowed_tools: "mcp__github__create_pending_pull_request_review,mcp__github__add_pull_request_review_comment_to_pending_review,mcp__github__submit_pending_pull_request_review,mcp__github__get_pull_request_diff"
direct_prompt: |
You are a senior product engineer.
Please provide a thorough review of this pull request.
Pay extra attention to coding standards, security practices,
test coverage, readability, maintainability, and performance.
Focus on:
- Correctness & hidden bugs (edge cases, race conditions, off-by-one, etc.)
- Performance hot-spots (Big-O, memory, DB queries, async misuse)
- Security implications and vulnerabilities (injection, XSS, secrets exposure)
- Readability & maintainability (naming, duplication, comments)
- Test coverage gaps (suggest unit/integration tests)
- Code quality and best practices
- Potential bugs or issues
- Performance considerations
- Documentation updates if needed
- Architecture and design decisions
Reply with:
- *One-sentence purpose summary* of the snippet.
- A **table** with columns **Severity (Critical/High/Medium/Low)**, **Line(s)**, **Issue**, **Recommendation**.
- Concrete code samples for any non-trivial fix.
- An overall quality score **/10** and the top 3 next steps.
Provide constructive feedback with specific suggestions for improvement.
Use inline comments to highlight specific areas of concern.
Use <details> and <summary> md tags to show summary in comment and view details on click
Please review this PR and provide inline feedback using the GitHub review system. Follow these steps:
1. **Start a review**: Use `mcp__github__create_pending_pull_request_review` to begin a pending review
2. **Get diff information**: Use `mcp__github__get_pull_request_diff` to understand the code changes and line numbers
3. **Add inline comments**: Use `mcp__github__add_pull_request_review_comment_to_pending_review` for each specific piece of feedback on particular lines
4. **Submit the review**: Use `mcp__github__submit_pending_pull_request_review` with event type "COMMENT" (not "REQUEST_CHANGES") to publish all comments as a non-blocking review
Provide specific, actionable feedback. Use inline comments for line-specific issues and include an overall summary when submitting the review. **Important**: Submit as "COMMENT" type so the review doesn't block the PR.