Files
xtone__ai_development_tools/.github/workflows/pr-review-vertex-ai.yml
toyota 9af7f62adb refactor: remove program-oriented review sections from PR review prompt
Remove Code Quality, Security, Testing, and Performance sections
as this repository is a skill marketplace, not a program repository.
Focus solely on Skill Quality review using /claude-skill-review skill.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 14:36:59 +09:00

179 lines
7.2 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Automated PR Review (Vertex AI)
on:
pull_request:
types: [opened, synchronize, reopened]
paths-ignore:
- '.github/workflows/**'
- '.claude/skills/**'
- '*.md'
- 'LICENSE'
permissions:
contents: read
pull-requests: write
issues: write
id-token: write # Workload Identity Federation用
jobs:
automated-review:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@v2
with:
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Run Claude Code PR Review via Vertex AI
uses: anthropics/claude-code-action@v1
env:
ANTHROPIC_VERTEX_PROJECT_ID: ${{ steps.auth.outputs.project_id }}
CLOUD_ML_REGION: global
GH_TOKEN: ${{ steps.app-token.outputs.token }}
with:
github_token: ${{ steps.app-token.outputs.token }}
use_vertex: "true"
prompt: |
このPull Requestをレビューしてください。
**重要**: このリポジトリはClaude Codeのスキル(プラグイン)マーケットプレイスです。
スキルファイル(SKILL.md)の品質と構造を重点的にレビューしてください。
**PR情報**:
- リポジトリ: ${{ github.repository }}
- PR番号: ${{ github.event.pull_request.number }}
- ブランチ: ${{ github.event.pull_request.head.ref }}
- ベースブランチ: ${{ github.event.pull_request.base.ref }}
- 作成者: ${{ github.event.pull_request.user.login }}
## レビューワークフロー
### ステップ1: PR情報の取得
まず、`gh`コマンドを使用してPR情報を取得してください:
```bash
# PR基本情報の取得
gh pr view ${{ github.event.pull_request.number }} --json title,body,author,createdAt,headRefName,baseRefName,mergeable,reviewDecision
# 変更ファイル一覧の取得
gh pr diff ${{ github.event.pull_request.number }} --name-only
# コード差分の取得
gh pr diff ${{ github.event.pull_request.number }}
# 既存のレビューとコメントの確認
gh pr view ${{ github.event.pull_request.number }} --json reviews,comments
```
### ステップ2: スキル品質分析
`/claude-skill-review` スキルを使用してスキル品質をレビューしてください。
```
/claude-skill-review
```
スキルを実行し、出力された評価結果をレビューコメントに含めてください。
### ステップ3: 問題の分類とインラインコメント投稿
検出された問題を以下のカテゴリーに分類してください:
| 重要度 | 説明 | スコア影響 | アクション |
|--------|------|------------|------------|
| **Critical** | マージ前に必ず修正が必要な問題(フロントマター欠落、必須項目不足等) | -3点 | REQUEST_CHANGES + インラインコメント |
| **Major** | 優先的に修正すべき問題(トリガー条件不足、参照ファイル欠落等) | -2点 | インラインコメント |
| **Minor** | 改善の余地があるがすぐには影響しない問題 | -1点 | インラインコメント |
| **Suggestion** | ベストプラクティスや最適化の提案 | -0.5点 | インラインコメント(任意) |
**インラインコメントの投稿**:
具体的なファイルと行番号が特定できる問題については、`mcp__github_inline_comment__create_inline_comment`ツールを使用してインラインコメントを投稿してください。
### ステップ4: レビュー結果の投稿
分析結果に基づいて、`gh`コマンドを使用してレビューを投稿してください:
#### パターン1: Critical問題がある場合
```bash
gh pr review ${{ github.event.pull_request.number }} \
--request-changes \
--body "## ⚠️ 変更が必要です
以下のCritical問題が検出されました。修正してから再度レビューをリクエストしてください。
### Critical問題
- [問題の概要] - 詳細はインラインコメントを参照
**注**: 具体的な問題箇所と修正方法はファイルのインラインコメントで指摘しています。
修正後、このレビューを解決してください。"
```
#### パターン2: Major/Minor問題がある場合
```bash
gh pr review ${{ github.event.pull_request.number }} \
--approve \
--body "## ✅ 条件付きでApprove
レビューを完了しました。重大な問題は見つかりませんでしたが、いくつかの改善点があります。
### 分析結果
#### 📦 Skill Quality: X/10
- 良い点: [概要]
- 改善点: [件数]件の指摘(インラインコメント参照)
### 改善項目
**注**: 具体的な改善箇所と推奨される対応は、各ファイルのインラインコメントで詳しく説明しています。
これらは次のイテレーションで対応することをお勧めします。"
```
#### パターン3: 問題がない場合
```bash
gh pr review ${{ github.event.pull_request.number }} \
--approve \
--body "## ✅ Approved
レビューを完了しました。問題は見つかりませんでした。
### 分析結果
#### 📦 Skill Quality: 10/10
✅ フロントマターが正しく設定されています
✅ descriptionにトリガー条件が明記されています
✅ ディレクトリ構造が適切です
✅ 参照ファイルがすべて存在します
### Summary
マージして問題ありません。"
```
## 重要な注意事項
- レビューはAIによる自動分析であり、最終的な判断は人間のレビュアーが行う必要があります
- スキルの実用性やドメイン知識が必要な判断は人間のレビューが必要です
claude_args: |
--model claude-sonnet-4-5@20250929
--allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh:*)"