|
9 | 9 | types: [created] |
10 | 10 |
|
11 | 11 | jobs: |
| 12 | + pr-description: |
| 13 | + name: Generate PR Description |
| 14 | + if: | |
| 15 | + github.event_name == 'pull_request' && |
| 16 | + github.event.action == 'opened' && |
| 17 | + github.event.pull_request.user.login != 'dependabot[bot]' && |
| 18 | + !contains(github.event.pull_request.title, 'Release') |
| 19 | + |
| 20 | + runs-on: ubuntu-latest |
| 21 | + permissions: |
| 22 | + contents: read |
| 23 | + pull-requests: write |
| 24 | + |
| 25 | + steps: |
| 26 | + - name: Check PR Description |
| 27 | + id: check_description |
| 28 | + env: |
| 29 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 30 | + run: | |
| 31 | + PR_BODY=$(gh pr view ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --json body --jq '.body') |
| 32 | + |
| 33 | + # Check if body is empty or just whitespace |
| 34 | + if [ -z "$(echo "$PR_BODY" | tr -d '[:space:]')" ]; then |
| 35 | + echo "empty=true" >> $GITHUB_OUTPUT |
| 36 | + else |
| 37 | + echo "empty=false" >> $GITHUB_OUTPUT |
| 38 | + fi |
| 39 | +
|
| 40 | + - name: Checkout repository |
| 41 | + if: steps.check_description.outputs.empty == 'true' |
| 42 | + uses: actions/checkout@v4 |
| 43 | + with: |
| 44 | + fetch-depth: 0 |
| 45 | + |
| 46 | + - name: Generate PR Description with Claude |
| 47 | + if: steps.check_description.outputs.empty == 'true' |
| 48 | + uses: anthropics/claude-code-action@v1 |
| 49 | + with: |
| 50 | + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} |
| 51 | + prompt: | |
| 52 | + Generate a professional PR description for PR #${{ github.event.pull_request.number }}. |
| 53 | + |
| 54 | + Read CLAUDE.md and docs/llm.md to understand the project architecture and conventions. |
| 55 | + |
| 56 | + Analyze the changes in this PR and create a structured description following this format: |
| 57 | + |
| 58 | + ## Summary |
| 59 | + Brief 1-2 sentence overview of what this PR accomplishes. |
| 60 | + |
| 61 | + ## Changes |
| 62 | + - List key changes made (be specific about files/components modified) |
| 63 | + - Focus on what changed, not how (code speaks for itself) |
| 64 | + - Group related changes together |
| 65 | + |
| 66 | + ## Motivation |
| 67 | + Why was this change needed? What problem does it solve? |
| 68 | + |
| 69 | + ## Testing |
| 70 | + - How can reviewers test this? |
| 71 | + - What scenarios should be verified? |
| 72 | + |
| 73 | + ## Breaking Changes (if any) |
| 74 | + List any breaking changes or migration steps required. |
| 75 | + |
| 76 | + --- |
| 77 | + |
| 78 | + Guidelines: |
| 79 | + - Be concise and professional |
| 80 | + - Use markdown formatting |
| 81 | + - Do NOT use emojis |
| 82 | + - Focus on substance over style |
| 83 | + - Highlight important architectural decisions |
| 84 | + - Note any new dependencies or patterns introduced |
| 85 | + |
| 86 | + After generating the description, update the PR: |
| 87 | + ```bash |
| 88 | + gh pr edit ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --body "YOUR_GENERATED_DESCRIPTION" |
| 89 | + ``` |
| 90 | + |
| 91 | + claude_args: | |
| 92 | + --allowed-tools "Bash(gh pr view:*),Bash(gh pr diff:*),Bash(gh pr edit:*),Bash(gh api:*)" |
| 93 | + --max-turns 3 |
| 94 | + --model claude-sonnet-4-5-20250929 |
| 95 | +
|
12 | 96 | code-review: |
13 | 97 | name: Code Quality Review |
14 | 98 | if: | |
|
0 commit comments