Skip to content

Commit f515fc8

Browse files
authored
fix(issue-auto-implement): comment on PR and skip Create PR when trigger is issue_comment on PR (#252)
- Comment on PR (review iteration): run when issue_comment on PR (issue.pull_request) - Use PR_NUMBER from pull_request.number or issue.number for comment target - Create PR: skip when issue_comment on PR so we do not open a second PR - AGENTS.md: document that PR conversation comments trigger same iteration flow Made-with: Cursor
1 parent bdd5400 commit f515fc8

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

.github/actions/issue-auto-implement/AGENTS.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ For agents making changes to this action. This file summarizes flows, design dec
1414
- **Trigger:** `issue_comment.created` on an issue that **already has an open PR** for that issue.
1515
- **Flow:** Post a short reply on the issue directing the user to the PR; exit. No assessment or implement.
1616

17-
### 3. PR review → iteration
17+
### 3. PR review or PR conversation comment → iteration
1818

19-
- **Triggers:** `pull_request_review.submitted`, `pull_request_review_comment.created` when the PR is from an automation branch or body contains "Closes #N".
20-
- **Flow:** Resolve issue number from PR (body "Closes #N"/"Fixes #N" or head branch `auto-implement-issue-<N>`) → assess with issue + review content → implement ("address review feedback"), push to same branch → verify → on pass: do **not** create PR; post comment on the PR summarizing the new commit(s).
19+
- **Triggers:** `pull_request_review.submitted`, `pull_request_review_comment.created`, or `issue_comment.created` **on a PR** (when `issue.pull_request` is set) when the PR is from an automation branch or body contains "Closes #N".
20+
- **Flow:** Resolve issue number from PR (body "Closes #N"/"Fixes #N" or head branch `auto-implement-issue-<N>`) → assess with issue + review/comment content → implement ("address review feedback"), push to same branch → verify → on pass: do **not** create PR; post comment on the PR summarizing the new commit(s).
2121

2222
## Event normalization
2323

@@ -41,7 +41,7 @@ From the workflow event payload, derive:
4141

4242
## Implement–verify loop
4343

44-
- **Single step** `implement_verify_loop`: for each attempt from 1 to `max_implement_retries`, run implement (with `PREVIOUS_VERIFY_OUTPUT` from the previous failure, if any), commit and push, then run `verify_commands`. If verify passes, exit success. If it fails, set the verify output as `PREVIOUS_VERIFY_OUTPUT` and retry. After all attempts, fail. When this step succeeds: if trigger was `pull_request_review` or `pull_request_review_comment`, post a comment on the existing PR (no new PR); otherwise create PR.
44+
- **Single step** `implement_verify_loop`: for each attempt from 1 to `max_implement_retries`, run implement (with `PREVIOUS_VERIFY_OUTPUT` from the previous failure, if any), commit and push, then run `verify_commands`. If verify passes, exit success. If it fails, set the verify output as `PREVIOUS_VERIFY_OUTPUT` and retry. After all attempts, fail. When this step succeeds: if trigger was `pull_request_review`, `pull_request_review_comment`, or `issue_comment` on a PR (`issue.pull_request` set), post a comment on the existing PR (no new PR); otherwise create PR.
4545

4646
## Branch and PR
4747

.github/actions/issue-auto-implement/action.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,13 +266,13 @@ runs:
266266
-d "$(jq -n --arg b "$BODY" '{body: $b}')"
267267
echo "Posted comment on issue #$ISSUE_NUMBER (verify exhausted)"
268268
- name: Comment on PR (review iteration)
269-
if: steps.assess.outputs.action == 'implement' && steps.implement_verify_loop.outcome == 'success' && (github.event_name == 'pull_request_review' || github.event_name == 'pull_request_review_comment')
269+
if: steps.assess.outputs.action == 'implement' && steps.implement_verify_loop.outcome == 'success' && (github.event_name == 'pull_request_review' || github.event_name == 'pull_request_review_comment' || (github.event_name == 'issue_comment' && github.event.issue.pull_request))
270270
shell: bash
271271
env:
272272
GITHUB_TOKEN: ${{ inputs.github_token }}
273273
REPO: ${{ github.repository }}
274-
PR_NUMBER: ${{ github.event.pull_request.number }}
275-
HEAD_REF: ${{ github.event.pull_request.head.ref }}
274+
PR_NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }}
275+
HEAD_REF: ${{ github.event.pull_request.head.ref || format('auto-implement-issue-{0}', steps.assess.outputs.issue_number) }}
276276
run: |
277277
BODY="Addressed review feedback. New commit(s) pushed; verification passed."
278278
curl -s -X POST \
@@ -289,7 +289,7 @@ runs:
289289
-d "$(jq -n --arg ref "$HEAD_REF" '{ref: $ref}')"
290290
echo "Triggered test workflow on ref $HEAD_REF"
291291
- name: Create PR
292-
if: steps.assess.outputs.action == 'implement' && steps.implement_verify_loop.outcome == 'success' && github.event_name != 'pull_request_review' && github.event_name != 'pull_request_review_comment'
292+
if: steps.assess.outputs.action == 'implement' && steps.implement_verify_loop.outcome == 'success' && github.event_name != 'pull_request_review' && github.event_name != 'pull_request_review_comment' && !(github.event_name == 'issue_comment' && github.event.issue.pull_request)
293293
shell: bash
294294
env:
295295
GITHUB_TOKEN: ${{ inputs.github_token }}

0 commit comments

Comments
 (0)