63 lines
2.2 KiB
YAML

name: 'Claude: Generate PR Title & Description'
# Consumer workflow that generates PR titles and descriptions using Claude AI
#
# This workflow automatically generates:
# - Conventional commit-style PR titles based on repository patterns
# - Comprehensive PR descriptions based on recent merged PR templates
#
# Triggers:
# - When a PR is opened (draft or ready)
# - When a PR is marked as ready for review
# - When a PR is synchronized (new commits pushed) with actual code changes
#
# Features:
# - Skips rebases (uses patch-ID to detect actual code changes)
# - Learns title patterns from recent commits
# - Learns description templates from recent merged PRs
# - Conventional commit format enforcement
on:
pull_request:
types: [opened, synchronize, ready_for_review]
permissions: {}
# Concurrency: Cancel in-flight runs for the same PR
concurrency:
group: pr-metadata-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
generate-metadata:
permissions:
contents: read
id-token: write
pull-requests: write
# Skip conditions:
# - Fork PRs (no secrets available)
# - Merge queue PRs (handled separately)
# - Dependabot PRs (already have proper titles)
# - Release PRs (have their own format)
# - Production promotion PRs (have their own format)
if: |
github.event.pull_request.head.repo.full_name == github.repository &&
!contains(github.head_ref, 'gh-readonly-queue/') &&
!contains(github.head_ref, 'dependabot/') &&
!contains(github.head_ref, 'release/') &&
!startsWith(github.event.pull_request.title, 'chore(release):')
uses: Uniswap/ai-toolkit/.github/workflows/_generate-pr-metadata.yml@b229e128e6a60bc6a495e80bda9f13d6bafdfc5e
with:
generation_mode: 'title,description'
pr_number: ${{ github.event.pull_request.number }}
base_ref: ${{ github.base_ref }}
# Use default model (claude-sonnet-4-5-20250929)
# Use default timeout (15 minutes)
# Use default prompt from ai-toolkit
commit_history_count: 30
pr_history_count: 10
secrets:
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
WORKFLOW_PAT: ${{ secrets.WORKFLOW_PAT }}