Skip to content

Instantly share code, notes, and snippets.

@carlosmgv02
Created January 22, 2026 09:34
Show Gist options
  • Select an option

  • Save carlosmgv02/957e99a79ae5a4fd13cd7c03676d7e08 to your computer and use it in GitHub Desktop.

Select an option

Save carlosmgv02/957e99a79ae5a4fd13cd7c03676d7e08 to your computer and use it in GitHub Desktop.
PR Deployment Review with Claude Code Action
# =============================================================================
# PR Deployment Review with Claude Code Action
# =============================================================================
#
# This workflow uses Claude AI to automatically generate a deployment checklist
# when a PR is ready to be merged to production.
#
# HOW IT WORKS:
# 1. Add the label "deployment-review" to any PR targeting master/main
# 2. Claude analyzes the changes and generates a checklist
# 3. The checklist is posted as a comment on the PR
#
# WHY LABEL-TRIGGERED?
# - Cost-effective: Only runs when explicitly requested, not on every commit
# - On-demand: Review when YOU decide the PR is ready
# - Avoids token waste on WIP branches
#
# REQUIREMENTS:
# - Add ANTHROPIC_API_KEY to your repository secrets
# - Create the "deployment-review" label in your repository
#
# =============================================================================
name: PR Deployment Review
on:
pull_request:
types: [labeled]
branches: [master, main]
# Prevent duplicate runs for the same PR
concurrency:
group: deployment-review-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
deployment-review:
# Only runs when the "deployment-review" label is added
if: github.event.label.name == 'deployment-review'
runs-on: ubuntu-latest
timeout-minutes: 5 # Prevents runaway costs
permissions:
contents: read
pull-requests: write
id-token: write # Required for Claude Code Action OIDC
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0 # Full history for better diff analysis
- name: Run Claude Deployment Review
uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
# Claude automatically reads CLAUDE.md for project context
prompt: |
Generate a Deployment Checklist for PR #${{ github.event.pull_request.number }}.
Analyze the changes and check for:
BACKEND:
- Environment variables: new configs, secrets, feature flags
- Database migrations: warn if destructive (DROP/DELETE/TRUNCATE)
- API changes: breaking changes, removed endpoints
- Dependencies: new packages, version updates
- Security: authentication, authorization, input validation
FRONTEND:
- Environment variables: NEXT_PUBLIC_*, VITE_* variables
- Dependencies: package.json changes
- API integration: changes requiring backend coordination
INFRASTRUCTURE:
- Docker/container changes
- CI/CD pipeline modifications
- Cloud resource requirements
Response format:
## Deployment Checklist
### Pre-deployment
- [ ] Action item
### Post-deployment
- [ ] Verification step
### Warnings
- Important consideration
If nothing special needed: "Ready to deploy - no special actions required."
Be concise. Skip empty sections.
# Limit iterations to control costs
claude_args: "--max-turns 3"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment