Add Claude Code automatic PR reviews #1
Workflow file for this run
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: | |
| # Only auto-review PRs into dev. Promotions from dev to main re-package | |
| # already-reviewed work, and comment @claude on any PR for an on-demand review. | |
| branches: [dev] | |
| types: [opened, synchronize, ready_for_review, reopened] | |
| # To limit reviews to certain files, uncomment and adjust: | |
| # paths: | |
| # - "**/*.sql" | |
| # - "**/*.ps1" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| claude-review: | |
| # Skip draft PRs (reviewed when marked ready) and fork PRs: GitHub does not | |
| # expose repo secrets to workflows triggered from forks, so the review can | |
| # only run on same-repo branches. Use @claude comments for fork PRs. | |
| if: ${{ !github.event.pull_request.draft && github.event.pull_request.head.repo.full_name == github.repository }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| id-token: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Run Claude Code Review | |
| uses: anthropics/claude-code-action@v1 | |
| with: | |
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | |
| track_progress: true | |
| prompt: | | |
| REPO: ${{ github.repository }} | |
| PR NUMBER: ${{ github.event.pull_request.number }} | |
| This repository contains Erik Darling's SQL Server troubleshooting stored | |
| procedures. Most changes are to large, self-contained T-SQL stored | |
| procedures, plus PowerShell tooling and CI scripts. The repository | |
| CLAUDE.md is the canonical T-SQL style guide. | |
| Review this pull request with these priorities: | |
| 1. Correctness: logic errors, NULL handling, dynamic SQL construction | |
| (quoting, QUOTENAME, parameterized sp_executesql), cursor handling, | |
| error handling, and overflow safety (COUNT_BIG, ROWCOUNT_BIG). | |
| 2. SQL Server version compatibility: procedures support a range of | |
| versions (generally 2016 through 2025, plus Azure SQL DB and Managed | |
| Instance where the procedure documents support). Flag newer T-SQL | |
| syntax (STRING_AGG, CONCAT_WS, GREATEST/LEAST, TRIM, etc.) or DMV | |
| columns used without the version/feature gating patterns the | |
| procedure already uses elsewhere. | |
| 3. Self-containment: procedures must not gain dependencies on helper | |
| functions, views, or other database objects. | |
| 4. Style: flag clear CLAUDE.md violations (tabs, -- comments instead of | |
| /* */ blocks, abbreviated data types or keywords, missing table | |
| aliases, missing semicolons). Do not nitpick. | |
| Repo-specific rules: | |
| - Install-All/DarlingData.sql is auto-generated by CI. If this PR edits | |
| it directly, flag that as a blocking problem: only per-procedure | |
| source files should change. | |
| - The @version / @version_date lines in procedures only change in | |
| release PRs from the maintainer (erikdarlingdata). If any other PR | |
| bumps them, ask for that to be reverted. | |
| The PR branch is already checked out in the current working directory. | |
| Use inline comments for specific issues and one summary comment for the | |
| overall review. Only the GitHub comments you post will be seen, so put | |
| all feedback there rather than in a normal response. If the changes look | |
| good, say so briefly and do not invent problems. | |
| claude_args: | | |
| --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*)" |