Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions .github/workflows/claude-code-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
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@v6
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:*)"
39 changes: 39 additions & 0 deletions .github/workflows/claude.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Claude Code

on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]

jobs:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor/optional: unlike claude-code-review.yml, this workflow has no concurrency group. If a user posts several @claude comments in quick succession on the same PR/issue, multiple runs could execute concurrently and push conflicting commits to the same branch. Not a blocker, but worth considering something like:

concurrency:
  group: claude-${{ github.event.issue.number || github.event.pull_request.number }}
  cancel-in-progress: false

(cancel-in-progress: false since you likely don't want to cancel a change already in progress, just serialize new triggers.)

claude:
# Only users with write access to the repo can trigger this; the action
# enforces that check on the commenting user. This is also the way to get a
# review on fork PRs, where the automatic review workflow cannot run.
if: |
(github.event_name == 'issue_comment' && 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')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
actions: read
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 1

- name: Run Claude Code
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
Loading