|
| 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" |
0 commit comments