GitHub Actions로 PR 리뷰받기
PR을 열 때마다 GitHub Actions에서 Claude Code가 리뷰 댓글을 달아 주어, 사람이 보기 전에 놓친 문제를 먼저 걸러 냅니다.
/install-github-app으로 GitHub 앱과 비밀값을 넣고, PR이 열릴 때 돌 워크플로를 추가합니다. 댓글에 @claude를 달면 그 자리에서 고치거나 답하게 하는 워크플로도 함께 둘 수 있습니다. 명령과 설정 이름은 2026년 11월 21일에 Claude Code 공식 문서로 확인했습니다.
준비
- Claude Code 설치와 로그인
1. 앱과 비밀값 설치
저장소 관리자 권한으로 Claude Code에서 /install-github-app을 실행합니다. Claude GitHub 앱을 설치하고 ANTHROPIC_API_KEY 또는 CLAUDE_CODE_OAUTH_TOKEN을 저장소 비밀값으로 넣어 줍니다.
/install-github-app결과: 설치된 Claude 앱과 저장소 비밀값
확인: 저장소 Settings > Secrets에 키 이름이 보이는지 확인
2. PR 자동 리뷰 워크플로
.github/workflows/claude-review.yml을 만듭니다. 공식 code-review 플러그인을 불러 PR에 인라인 댓글을 답니다. prompt의 --comment가 있어야 PR에 댓글이 달립니다.
name: Code Review
on:
pull_request:
types: [opened, synchronize, ready_for_review, reopened]
jobs:
review:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: read
id-token: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
plugin_marketplaces: "https://github.com/anthropics/claude-plugins-official.git"
plugins: "code-review@claude-plugins-official"
prompt: "/code-review:code-review --comment ${{ github.repository }}/pull/${{ github.event.pull_request.number }}"
claude_args: '--allowedTools "mcp__github_inline_comment__create_inline_comment"'결과: 리뷰 워크플로 파일
확인: 커밋 후 Actions 탭에 Code Review 워크플로가 보이는지 확인
3. @claude로 부르는 워크플로 (선택)
PR이나 이슈 댓글에 @claude를 달면 응답하게 하려면 prompt 없이 액션을 둡니다. 쓰기 권한이 있는 사람이 단 댓글만 처리합니다.
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
jobs:
claude:
if: contains(github.event.comment.body, '@claude')
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
actions: read
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 1
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}결과: @claude 워크플로 파일
확인: PR 댓글에 @claude를 달아 응답 댓글이 오는지 확인
4. 시험 PR 열기
작은 변경으로 PR을 열고 워크플로가 끝날 때까지 기다립니다.
결과: PR의 리뷰 댓글
확인: Actions 실행이 성공으로 끝나고 PR에 댓글이 달렸는지 확인
주의
- 공개 저장소의 포크 PR에는 비밀값이 전달되지 않아 리뷰가 돌지 않음
- API 키로 돌리면 실행마다 요금 발생. claude_args의 --max-turns로 한도 두기
- id-token: write 권한이 빠지면 기본 GitHub 앱 인증이 실패
- 예전 @beta 태그를 쓰고 있으면 @v1로 바꾸기
참고 자료
- 1claude-code-action 입력값github.com
댓글