Skip to content

Add Claude Code workflow for AI-assisted PR reviews #31

Add Claude Code workflow for AI-assisted PR reviews

Add Claude Code workflow for AI-assisted PR reviews #31

Workflow file for this run

name: Claude Code
# AI-assisted PR reviews and interactive @claude mentions.
#
# The actual Claude Code execution runs in eng-dev-ecosystem on
# protected runners whose IPs are allowlisted by the Databricks
# account IP ACL. This workflow is a thin trigger that dispatches
# to eng-dev-ecosystem via the DECO workflow trigger GitHub App.
on:
pull_request:
types: [opened]
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
jobs:
# Automatic review on PR open. For re-reviews, comment "@claude review".
review:
if: github.event_name == 'pull_request'
concurrency:
group: claude-review-${{ github.event.pull_request.number }}
cancel-in-progress: true
runs-on:
group: databricks-deco-testing-runner-group
labels: ubuntu-latest-deco
environment: test-trigger-is
permissions:
contents: read
steps:
- name: Generate GitHub App token
id: token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.DECO_WORKFLOW_TRIGGER_APP_ID }}
private-key: ${{ secrets.DECO_WORKFLOW_TRIGGER_PRIVATE_KEY }}
owner: databricks-eng
repositories: eng-dev-ecosystem
- name: Trigger Claude Code review
run: |
gh workflow run cli-claude-code.yml \
-R databricks-eng/eng-dev-ecosystem \
--ref add-claude-code-workflow \
-F pull_request_number=${{ github.event.pull_request.number }} \
-F event_type=review
env:
GH_TOKEN: ${{ steps.token.outputs.token }}
# Interactive @claude mentions.
assist:
if: |
github.event.comment.user.type != 'Bot' &&
(
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude'))
)
runs-on:
group: databricks-deco-testing-runner-group
labels: ubuntu-latest-deco
environment: test-trigger-is
permissions:
contents: read
steps:
- name: Generate GitHub App token
id: token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.DECO_WORKFLOW_TRIGGER_APP_ID }}
private-key: ${{ secrets.DECO_WORKFLOW_TRIGGER_PRIVATE_KEY }}
owner: databricks-eng
repositories: eng-dev-ecosystem
- name: Determine PR number
id: pr
run: |
if [ -n "$ISSUE_NUMBER" ]; then
echo "number=$ISSUE_NUMBER" >> "$GITHUB_OUTPUT"
else
echo "number=$PR_NUMBER" >> "$GITHUB_OUTPUT"
fi
env:
ISSUE_NUMBER: ${{ github.event.issue.number }}
PR_NUMBER: ${{ github.event.pull_request.number }}
- name: Trigger Claude Code assist
uses: actions/github-script@v7
with:
github-token: ${{ steps.token.outputs.token }}
script: |
await github.rest.actions.createWorkflowDispatch({
owner: 'databricks-eng',
repo: 'eng-dev-ecosystem',
workflow_id: 'cli-claude-code.yml',
ref: 'add-claude-code-workflow',
inputs: {
pull_request_number: '${{ steps.pr.outputs.number }}',
event_type: 'assist',
comment_body: process.env.COMMENT_BODY
}
});
env:
COMMENT_BODY: ${{ github.event.comment.body }}