Modify script for code review testing #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Claude Code Review | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
jobs: | |
review: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.x" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install anthropic requests | |
- name: Run Claude review script | |
env: | |
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
run: python review_script.py | |
- name: Post comments | |
uses: actions/github-script@v4 | |
with: | |
script: | | |
const fs = require('fs'); | |
const comments = JSON.parse(fs.readFileSync('comments.json')); | |
for (const comment of comments) { | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: comment | |
}); | |
} |