Claude Code Action を導入して、Workflow の中身を見てみた
2025年5月23日開催された Anthropic「Code w/ Claude」内セッション Mastering Claude Code in 30 minutes にて Claude Code GitHub Actions(claude-code-action) が紹介されていました。
試したことがなかったので動かしてみることにします。
この記事でやること
- Claude Code Action を使って GitHub 上で Claude Code を動かす
- セットアップ手順をハンズオンで確認する
やることのイメージ

やらないこと
- GitHub Actions の説明
- GitHub CLI (gh) の導入や使用方法
Claude Code Action とは何か
Claude Code Action は、GitHub Actions のワークフロー上で Claude を実行し、Issue や Pull Request を起点に開発タスクを自動化できる仕組みです。
@claude メンションをトリガーに、コード修正・レビュー・PR作成まで実行できます。

ここからは、実際に自分の GitHub で動かせるようにするために、Claude Code Action のセットアップ手順を順を追って見ていきます。
Claude Code Action を動かしてみる
GitHub CLI(gh)の認証済みを前提にしています。未設定の場合は、ターミナルで gh auth login を実行して、案内に沿ってログインを完了してください。
Claude Code Action のセットアップ
Claude を開いて /install-github-app を実行するだけです。
「GitHub App をどのリポジトリにインストールするか」 聞かれます。なので、Claude Code Action を使用したいリポジトリのルートディレクトリで実行して、Use current repositoryを選択しました。
> Use current repository: account_name/repository_name
リポジトリ選択後、GitHub 上で Claude の GitHub App インストール画面が開きます。

画面を見ると、GitHub の PR や Issue 上で Claude Code を動かして、レビュー対応、コード修正ができますと書いてあります。
設定内容に問題がなければ「Configure」(初めての場合は「Install」?)をクリックして連携は完了です。
ブラウザでClaudeのGitHub Appのインストールが完了したら、ターミナルに戻ります。ターミナルにて、インストールするGitHub Actionのワークフローを質問されます。
- Issueの内容を、Claudeに読ませて実装してPR作ってもらいたいので、「@Claude Code」にチェック
- PRが開かれたらClaudeに自動でレビューしてもらうたいので、「Claude Code Review」にチェック
上記の内容でチェックし、Enterで確定。
次に、APIキー設定方法を選べと出ました。
Claude.aiの契約プラン(自分はproプラン)を利用したいので「Create a long-lived token with your Claude subscription」を選択。
複数人で使う場合、個人アカウントを共有するより、チーム向けに管理できるAPIキー方式のほうがいいと思います。たとえば、Anthropic ConsoleのAPIキーや、Amazon Bedrockを使うといいと思います。
セットアップが完了すると、ターミナルに Success と表示されます。あわせて、GitHub Actions のワークフローファイル(.github/workflows/claude.yml)がリポジトリ内に作成され、Claude が利用する認証情報(CLAUDE_CODE_OAUTH_TOKEN)が GitHub Secrets に保存されました。

GitHubの対象レポジトリで「Settings」→「Secrets and variables」→「Actions」を確認すると、シークレットが追加されていることが確認できます。
GitHubでは、PRが作られるので、マージして設定は完了します。

セットアップはこれで完了です。
生成された Workflow を読む
セットアップにて、チェックをいれた2つのワークフロー(「@Claude Code」と「Claude Code Review」)が、ワークフローファイルとして追加されました。
.github/workflows/claude.yml.github/workflows/claude-code-review.yml
この2つのワークフローがどのようなものなのかを確認していきます。
claude.yml
1つ目は Claude Code という名前のワークフローです。
claude.yml 全文
name: Claude Code
on:
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
actions: read # Required for Claude to read CI results on PRs
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
# This is an optional setting that allows Claude to read CI results on PRs
additional_permissions: |
actions: read
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
# prompt: 'Update the pull request description to include a summary of changes.'
# Optional: Add claude_args to customize behavior and configuration
# 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 pr:*)'
私が実行した時点は上記の内容でした。
on:を見るとわかりますが、以下をトリガーにワークフローを実行してます。
- Issue にコメントが作成されたとき
- PRにコメントが作成されたとき
- Issue が作成・アサインされたとき
- PR レビューが送信されたとき
また、IssueかPRのコメント、レビュー本文、Issueの本文かタイトルのいずれかに @claude が含まれたことをトリガーにしても、ワークフローが実行されるようになってます。
ちなみに、Claude Code Action に該当するのは、このステップだけだと思います。
- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
ワークフロー全体は GitHub Actions で、その中のステップとして anthropics/claude-code-action というアクションを呼び出している、という内容だと思います。
claude-code-review.yml
2つ目は Claude Code Review と言う名前のワークフローです。
claude-code-review.yml 全文
name: Claude Code Review
on:
pull_request:
types: [opened, synchronize, ready_for_review, reopened]
# Optional: Only run on specific file changes
# paths:
# - "src/**/*.ts"
# - "src/**/*.tsx"
# - "src/**/*.js"
# - "src/**/*.jsx"
jobs:
claude-review:
# Optional: Filter by PR author
# if: |
# github.event.pull_request.user.login == 'external-contributor' ||
# github.event.pull_request.user.login == 'new-developer' ||
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
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: 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 }}
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
plugins: 'code-review@claude-code-plugins'
prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
# 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
私が実行した時点は上記の内容でした。
onのところを見ると、トリガーは、PRが以下のいずれかのタイミングで発火します。
| イベント | 意味 |
|---|---|
| opened | PRが作られたとき |
| synchronize | PRにコミットが追加されたとき |
| ready_for_review | Draft から Open になったとき |
| reopened | 閉じた PR が再オープンされたとき |
pathsはコメントアウトされていました。有効にすると、指定したファイルのみ実行されると思います。
次に、Claude Code Action の部分を見ていきます。その中でも下記の部分に注目しました。
prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
prompt の内容
-
/code-review:code-reviewはコードレビュー用のコマンド -
${{ github.repository }}はリポジトリ名の指定 -
${{ github.event.pull_request.number }}はPR番号
結果としてryosuketter/my-item/pull/20のような PR URL が渡され、差分を Claude がレビューするのだと思います。
2つのワークフローの違い
両方とも anthropics/claude-code-action を使いますが、異なる点もあります。
| 項目 | claude.yml | claude-code-review.yml |
|---|---|---|
| トリガー | @claude を含むコメントや Issue | PR の作成・更新 |
| プロンプト | コメント内容をそのまま使用 | 固定で /code-review を指定 |
| プラグイン | なし | code-review@claude-code-plugins を使用 |
| 役割 | コメントで指示した作業を実行 | PR のコードレビューを自動実行 |
まとめると、claude.yml はコメントで指示した作業を行う「オンデマンド型」、claude-code-review.yml は PR ごとに自動でレビューする「自動実行型」ですね。
試してみる
claude.yml
Issueを作成し、その内容をもとに、ClaudeにPRを作らせてみた。

Issue に「@claude やって欲しい」とコメントして README.md の更新を依頼。ドキュメントの更新だけの小さい PR ですが、ワークフローが動いて、Claude がブランチを作成して PR をオープンするまで動くことは確認できた。
claude-code-review.yml
PRをレビューさせてみた。

結果としては「No issues found」で特に指摘は出なかったが、ワークフローが正常に動作し、PR 上に「Code review」コメントが投稿されていることは確認できた。
以上で導入手順の紹介は完了です。続いて、実運用で気をつけたいポイントを2点だけまとめます。
実運用で気をつけること
① プライベートリポジトリ推奨
公開リポジトリだと、第三者のコメントや操作を起点に意図しないワークフローの実行が起きる可能性があるため。
② 個人契約の認証情報は共有しない
再度になりますが、個人契約のClaude.aiを使う場合は、アカウント情報や認証情報を他人と共有しない方が良いと思います。
まとめ
Claude Code Action を実際にセットアップし、@claude で動くワークフローと、PR時に自動レビューするワークフローの違いと動作確認ができました。
参考
ちょっと株式会社(chot-inc.com)のエンジニアブログです。 フロントエンドエンジニア募集中! カジュアル面接申し込みはこちらから chot-inc.com/recruit/iuj62owig
Discussion