Centralize form submit handling #1597
This file contains hidden or 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] | |
| paths: # Only run on specific file changes | |
| - "src/**/*.cr" | |
| - "static/**/*.js" | |
| workflow_dispatch: | |
| inputs: | |
| pr_number: | |
| description: 'PR number to review' | |
| required: true | |
| type: string | |
| jobs: | |
| claude-review: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| issues: read | |
| id-token: write | |
| actions: read # Required for Claude to read CI results on PRs | |
| timeout-minutes: 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.event.pull_request.head.ref || github.ref }} | |
| repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} | |
| - name: Load review config | |
| id: config | |
| run: | | |
| { | |
| DELIM="EOF_$(openssl rand -hex 16)" | |
| echo "criteria<<$DELIM" | |
| cat .claude/review-criteria.md | |
| echo "$DELIM" | |
| MODEL=$(tr -d '[:space:]' < .claude/review-model) | |
| if [[ -z "$MODEL" ]]; then | |
| echo "::error::.claude/review-model is empty or missing" | |
| exit 1 | |
| fi | |
| echo "model=$MODEL" | |
| } >> "$GITHUB_OUTPUT" | |
| - uses: anthropics/claude-code-action@v1 | |
| with: | |
| anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} | |
| prompt: | | |
| REPO: ${{ github.repository }} | |
| PR_NUMBER: ${{ inputs.pr_number || github.event.pull_request.number }} | |
| Review this PR and report ONLY problems that need fixing. | |
| You have a maximum of 15 turns — finish well within that limit. | |
| Steps: | |
| 1. Run `gh pr diff` to read the changes | |
| 2. Analyze the diff. Only use Read/Glob/Grep if the diff alone is insufficient to understand a change. | |
| 3. Post findings with `gh pr comment --edit-last` (to update any previous review), or `gh pr comment` if no previous comment exists. | |
| ${{ steps.config.outputs.criteria }} | |
| claude_args: | | |
| --model ${{ steps.config.outputs.model }} | |
| --max-turns 20 | |
| --allowedTools "Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Read,Glob,Grep" |