ci: PRに対するTAKT Reviewワークフローを追加
Environment承認方式で、メンテナーが承認するまで実行されない。 レビュー結果はPRコメントとアーティファクトに出力。
This commit is contained in:
parent
4e9c02091a
commit
6d50221dd5
58
.github/workflows/takt-review.yml
vendored
Normal file
58
.github/workflows/takt-review.yml
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
name: TAKT PR Review
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, ready_for_review]
|
||||
|
||||
jobs:
|
||||
review:
|
||||
runs-on: ubuntu-latest
|
||||
environment: takt-review
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
|
||||
- name: Claude Code & TAKT インストール
|
||||
run: |
|
||||
npm install -g @anthropic-ai/claude-code
|
||||
npm install -g takt
|
||||
|
||||
- name: TAKT Review 実行
|
||||
run: takt --pipeline --skip-git -i ${{ github.event.pull_request.number }} -w review
|
||||
env:
|
||||
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: レビュー結果をPRコメントに投稿
|
||||
if: always()
|
||||
run: |
|
||||
REPORT_DIR=$(ls -td .takt/runs/*/reports 2>/dev/null | head -1)
|
||||
if [ -n "$REPORT_DIR" ]; then
|
||||
SUMMARY=$(find "$REPORT_DIR" -name "*review-summary*" -type f | head -1)
|
||||
if [ -n "$SUMMARY" ]; then
|
||||
gh pr comment ${{ github.event.pull_request.number }} --body-file "$SUMMARY"
|
||||
else
|
||||
echo "レビューサマリーが見つかりません"
|
||||
fi
|
||||
else
|
||||
echo "レポートディレクトリが見つかりません"
|
||||
fi
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: レビューレポートをアーティファクトに保存
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: takt-review-reports
|
||||
path: .takt/runs/*/reports/
|
||||
if-no-files-found: ignore
|
||||
Loading…
x
Reference in New Issue
Block a user