Skip to content

Commit 9782ec5

Browse files
rtioclaude
andauthored
Add address-comments agent workflow for PR comment resolution (#11350)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 93a6745 commit 9782ec5

File tree

3 files changed

+129
-1
lines changed

3 files changed

+129
-1
lines changed
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: "Agent Pipeline — Address Comments Stage"
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
linear_issue_id:
7+
type: string
8+
required: true
9+
description: "Linear issue ID (e.g. GAMMA-123) or issue description"
10+
target_branch:
11+
type: string
12+
required: false
13+
default: "develop"
14+
description: "Base branch to work from"
15+
branch_name:
16+
type: string
17+
required: true
18+
description: "Feature branch with the PR (created by dev stage)"
19+
pr_number:
20+
type: string
21+
required: true
22+
description: "Pull request number to address comments on"
23+
model:
24+
type: string
25+
required: false
26+
default: "claude-sonnet-4-5-20250929"
27+
description: "Claude model to use"
28+
29+
jobs:
30+
address-comments:
31+
name: "Address Comments: ${{ inputs.linear_issue_id }}"
32+
runs-on: ubuntu-latest
33+
timeout-minutes: 30
34+
35+
steps:
36+
- name: Checkout WooPayments
37+
uses: actions/checkout@v4
38+
with:
39+
ref: ${{ inputs.branch_name }}
40+
fetch-depth: 0
41+
token: ${{ secrets.BOTWOO_TOKEN }}
42+
43+
- name: Checkout WooCommerce (context)
44+
uses: actions/checkout@v4
45+
with:
46+
repository: woocommerce/woocommerce
47+
path: woocommerce
48+
sparse-checkout: |
49+
plugins/woocommerce/includes
50+
plugins/woocommerce/src
51+
plugins/woocommerce-blocks
52+
53+
- name: Checkout gamma-ai-tools (prompt templates)
54+
uses: actions/checkout@v4
55+
with:
56+
repository: Automattic/gamma-ai-tools
57+
github-server-url: https://github.a8c.com
58+
token: ${{ secrets.GHE_TOKEN }}
59+
path: .gamma-ai-tools
60+
sparse-checkout: prompts/pipeline
61+
62+
- name: Prepare prompt from template
63+
id: prompt
64+
run: |
65+
TEMPLATE=".gamma-ai-tools/prompts/pipeline/address-comments.md"
66+
if [ ! -f "$TEMPLATE" ]; then
67+
echo "::error::Prompt template not found: $TEMPLATE"
68+
exit 1
69+
fi
70+
71+
# Substitute variables
72+
sed \
73+
-e 's|{{PR_NUMBER}}|${{ inputs.pr_number }}|g' \
74+
-e 's|{{TARGET_BRANCH}}|${{ inputs.target_branch }}|g' \
75+
-e 's|{{BRANCH_NAME}}|${{ inputs.branch_name }}|g' \
76+
"$TEMPLATE" > /tmp/address-comments-prompt.md
77+
78+
# Write multiline output
79+
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
80+
echo "content<<$EOF" >> "$GITHUB_OUTPUT"
81+
cat /tmp/address-comments-prompt.md >> "$GITHUB_OUTPUT"
82+
echo "$EOF" >> "$GITHUB_OUTPUT"
83+
84+
- name: Clean up gamma-ai-tools checkout
85+
run: rm -rf .gamma-ai-tools
86+
87+
- name: Configure git for commits
88+
run: |
89+
git config user.name "botwoo"
90+
git config user.email "botwoo@users.noreply.github.com"
91+
92+
- name: Run Address Comments Agent
93+
id: address-comments
94+
uses: anthropics/claude-code-action@v1
95+
with:
96+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
97+
model: ${{ inputs.model }}
98+
prompt: ${{ steps.prompt.outputs.content }}
99+
max_turns: "30"
100+
allowed_tools: "Read,Glob,Grep,Edit,Write,Bash(git diff*),Bash(git log*),Bash(git blame*),Bash(git show*),Bash(git add *),Bash(git commit *),Bash(git push *),Bash(gh api *),Bash(gh pr *),Bash(npm run lint:*),Bash(npm run test:*),Bash(vendor/bin/phpcs *),Bash(npx eslint *)"
101+
102+
- name: Write job summary
103+
if: always()
104+
run: |
105+
echo "## Address Comments Agent Results" >> "$GITHUB_STEP_SUMMARY"
106+
echo "" >> "$GITHUB_STEP_SUMMARY"
107+
echo "**Issue:** ${{ inputs.linear_issue_id }}" >> "$GITHUB_STEP_SUMMARY"
108+
echo "**PR:** #${{ inputs.pr_number }}" >> "$GITHUB_STEP_SUMMARY"
109+
echo "**Branch:** ${{ inputs.branch_name }}" >> "$GITHUB_STEP_SUMMARY"
110+
echo "**Model:** ${{ inputs.model }}" >> "$GITHUB_STEP_SUMMARY"

.github/workflows/agent-pipeline.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
default: "develop"
1414
type: string
1515
stages:
16-
description: "Pipeline stages to run (comma-separated: plan,dev,review,compound)"
16+
description: "Pipeline stages to run (comma-separated: plan,dev,review,address-comments,compound)"
1717
required: false
1818
default: "plan"
1919
type: string
@@ -66,6 +66,20 @@ jobs:
6666
# model: ${{ inputs.model }}
6767
# secrets: inherit
6868

69+
# ─── Stage 3.5: Address Comments ─────────────────
70+
# Reads PR review comments and automated findings, implements fixes, replies.
71+
# address-comments:
72+
# needs: review
73+
# if: contains(inputs.stages, 'address-comments')
74+
# uses: ./.github/workflows/agent-address-comments.yml
75+
# with:
76+
# linear_issue_id: ${{ inputs.linear_issue_id }}
77+
# target_branch: ${{ inputs.target_branch }}
78+
# branch_name: ${{ needs.dev.outputs.branch_name }}
79+
# pr_number: ${{ needs.dev.outputs.pr_number }}
80+
# model: ${{ inputs.model }}
81+
# secrets: inherit
82+
6983
# ─── Human Gate (Phase 2) ────────────────────────
7084
# Requires GitHub Environment "agent-pipeline-approval" with required reviewers.
7185
# human-approval:
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: dev
3+
4+
Add agent-address-comments workflow for automated PR comment resolution

0 commit comments

Comments
 (0)