Skip to content

test: add edge case tests for transport lifecycle #322

test: add edge case tests for transport lifecycle

test: add edge case tests for transport lifecycle #322

name: Claude Code Review
on:
issue_comment:
types: [created]
concurrency:
group: claude-review-${{ github.event.issue.number }}
cancel-in-progress: true
jobs:
# Notify unauthorized users who try to use the command
notify-unauthorized:
if: |
github.event.issue.pull_request &&
(github.event.comment.body == '/claude-review' ||
startsWith(github.event.comment.body, '/claude-review ')) &&
github.event.comment.author_association != 'OWNER'
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: React to indicate unauthorized
env:
GH_TOKEN: ${{ github.token }}
run: |
gh api repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions \
-f content='-1'
# Acknowledge the command with a reaction
acknowledge:
if: |
github.event.issue.pull_request &&
(github.event.comment.body == '/claude-review' ||
startsWith(github.event.comment.body, '/claude-review ')) &&
github.event.comment.author_association == 'OWNER'
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: React to acknowledge command
env:
GH_TOKEN: ${{ github.token }}
run: |
gh api repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions \
-f content='+1'
claude-review:
needs: acknowledge
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
steps:
- name: Check if PR is from fork
env:
GH_TOKEN: ${{ github.token }}
run: |
IS_FORK=$(gh pr view ${{ github.event.issue.number }} --repo ${{ github.repository }} --json isCrossRepository -q '.isCrossRepository')
if [ "$IS_FORK" = "true" ]; then
echo "::error::Cannot review PRs from forks due to security concerns"
exit 1
fi
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
prompt: |
REPO: ${{ github.repository }}
PR NUMBER: ${{ github.event.issue.number }}
Please review this pull request and provide feedback on:
- Code quality and best practices
- Potential bugs or issues
- Performance considerations
- Security concerns
- Test coverage
Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
Use `gh pr comment` with your Bash tool to leave your review as a comment on the PR.
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://code.claude.com/docs/en/cli-reference for available options
claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"'