OpsLevel maturity + ADLC adjustments #5
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, ready_for_review, reopened] | |
| issue_comment: | |
| types: [created] | |
| pull_request_review_comment: | |
| types: [created] | |
| pull_request_review: | |
| types: [submitted] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| issues: read | |
| id-token: write | |
| jobs: | |
| review: | |
| if: | | |
| (github.event_name == 'pull_request' && github.event.pull_request.draft == false && github.event.pull_request.merged == false) || | |
| (github.event_name == 'issue_comment' && github.event.issue.pull_request && 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')) | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.issue.number || github.run_id }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Resolve PR number | |
| id: pr | |
| run: | | |
| if [ "${{ github.event_name }}" = "issue_comment" ]; then | |
| echo "number=${{ github.event.issue.number }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "number=${{ github.event.pull_request.number }}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: refs/pull/${{ steps.pr.outputs.number }}/head | |
| fetch-depth: 0 | |
| - name: Fetch PR diff | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh pr diff "${{ steps.pr.outputs.number }}" > /tmp/pr-diff.patch | |
| - name: Fetch previous reviews | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| PR_NUM="${{ steps.pr.outputs.number }}" | |
| REPO="${{ github.repository }}" | |
| { | |
| echo "=== Review Summaries ===" | |
| gh api "repos/${REPO}/pulls/${PR_NUM}/reviews" --paginate \ | |
| --jq '.[] | select(.state != "PENDING") | "[\(.user.login)] \(.state)\n\(.body)\n---"' 2>/dev/null || true | |
| echo "" | |
| echo "=== Inline Review Comments ===" | |
| gh api "repos/${REPO}/pulls/${PR_NUM}/comments" --paginate \ | |
| --jq '.[] | "[\(.user.login)] \(.path):\(.line // .original_line)\n\(.body)\n---"' 2>/dev/null || true | |
| echo "" | |
| echo "=== PR Conversation Comments ===" | |
| gh api "repos/${REPO}/issues/${PR_NUM}/comments" --paginate \ | |
| --jq '.[] | "[\(.user.login)]\n\(.body)\n---"' 2>/dev/null || true | |
| } > /tmp/previous-reviews.txt | |
| - name: Build review prompt | |
| id: prompt | |
| run: | | |
| DELIMITER="PROMPT_EOF_$(uuidgen)" | |
| { | |
| echo "REVIEW_PROMPT<<${DELIMITER}" | |
| for f in CLAUDE.md AGENTS.md; do | |
| if [ -f "$f" ]; then | |
| cat "$f" | |
| echo "" | |
| fi | |
| done | |
| if [ -f ".claude/review-prompt.md" ]; then | |
| cat .claude/review-prompt.md | |
| fi | |
| echo "${DELIMITER}" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Resolve claude_args | |
| id: args | |
| env: | |
| MODEL: ${{ vars.CLAUDE_REVIEW_MODEL }} | |
| run: | | |
| ALLOWED_TOOLS='Read,Glob,Grep,mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr view:*)' | |
| if [ -n "$MODEL" ]; then | |
| echo "value=--model ${MODEL} --max-turns 10 --allowedTools \"${ALLOWED_TOOLS}\"" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "value=--max-turns 10 --allowedTools \"${ALLOWED_TOOLS}\"" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Claude Code Review | |
| continue-on-error: true | |
| uses: anthropics/claude-code-action@v1 | |
| with: | |
| anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} | |
| allowed_bots: "custom-ink-triton" | |
| prompt: | | |
| You are reviewing PR #${{ steps.pr.outputs.number }}. | |
| The full diff is in /tmp/pr-diff.patch — Read that file first. | |
| Previous review comments are in /tmp/previous-reviews.txt — Read that file next. | |
| Do NOT run gh pr diff or git diff to re-fetch it. | |
| Use Read on source files if you need more context beyond the diff. | |
| IMPORTANT: Do NOT repeat or reiterate feedback that has already been given | |
| in previous reviews. If a prior reviewer (human or bot) already flagged an | |
| issue and the author has not addressed it in the current diff, you may | |
| reference it briefly but do not re-explain. Focus your review on NEW issues | |
| not covered by prior feedback. | |
| Post inline review comments and stop. | |
| Review this pull request using the following guidelines: | |
| ${{ steps.prompt.outputs.REVIEW_PROMPT }} | |
| claude_args: "${{ steps.args.outputs.value }}" |