Elffuss BraidHub

kikocis/continue public

Merge pull request #7593 from continuedev/nate/review-comment

Handle review comment threads in GitHub workflow
Changeset1c3151d9ec31f366e997079c20b3a6484150197b46b477619b8705a3e1efb5e3
AuthorTing-Wai <40179554+tingwai@users.noreply.github.com> · 2025-09-05 15:04 -07:00
CommitterGitHub <noreply@github.com> · 2025-09-05 15:04 -07:00
Parentsadd90d1f38c6, a4ca36bd23ee

Browse the files at this changeset

2 files changed

modified .github/workflows/respond-to-cubic.yaml +41 −3
@@ -172,21 +172,59 @@
172172 if: steps.check-mention.outputs.contains_mention == 'true'
173173 run: npm i -g @continuedev/cli
174174
175+ - name: Get review context
176+ if: steps.check-mention.outputs.contains_mention == 'true'
177+ id: review-context
178+ uses: actions/github-script@v7
179+ with:
180+ script: |
181+ let reviewContext = '';
182+
183+ // Check if this comment is a reply to another review comment
184+ if (context.payload.comment.in_reply_to_id) {
185+ try {
186+ const { data: originalComment } = await github.rest.pulls.getReviewComment({
187+ owner: context.repo.owner,
188+ repo: context.repo.repo,
189+ comment_id: context.payload.comment.in_reply_to_id
190+ });
191+
192+ reviewContext = `**Original review comment by @${originalComment.user.login}:**
193+ ${originalComment.body}
194+
195+ **Reply by @${{ github.event.comment.user.login }}:**
196+ ${{ github.event.comment.body }}`;
197+ } catch (error) {
198+ console.log('Could not fetch original comment, using current comment only');
199+ reviewContext = `**Review comment by @${{ github.event.comment.user.login }}:**
200+ ${{ github.event.comment.body }}`;
201+ }
202+ } else {
203+ reviewContext = `**Review comment by @${{ github.event.comment.user.login }}:**
204+ ${{ github.event.comment.body }}`;
205+ }
206+
207+ core.setOutput('context', reviewContext);
208+
175209 - name: Start remote session
176210 if: steps.check-mention.outputs.contains_mention == 'true'
177211 id: remote-session
178212 env:
179213 CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }}
180214 run: |
215+ # Debug: Echo the branch we're starting the session on
216+ echo "Starting remote session on branch: ${{ github.event.pull_request.head.ref }}"
217+
181218 # Create a temporary file for the prompt to handle special characters and newlines properly
182219 cat > /tmp/prompt.txt << 'PROMPT_EOF'
183- Please help with the following code review comment from @${{ github.event.comment.user.login }} on PR #${{ github.event.pull_request.number }}:
220+ Please help with the following code review discussion from PR #${{ github.event.pull_request.number }}:
184221
185222 **File:** ${{ github.event.comment.path }}
186223 **Line:** ${{ github.event.comment.line || github.event.comment.original_line || 'N/A' }}
187- **Comment:** ${{ github.event.comment.body }}
188224
189- Please analyze the specific file and line mentioned, understand the review feedback, implement the necessary changes, and commit them to this branch.
225+ ${{ steps.review-context.outputs.context }}
226+
227+ Please analyze the specific file and line mentioned, understand the review feedback and any discussion context, implement the necessary changes, and commit them to this branch.
190228 PROMPT_EOF
191229
192230 # Debug output
modified extensions/cli/src/tools/runTerminalCommand.ts +1 −1
@@ -33,7 +33,7 @@
3333 displayName: "Bash",
3434 description: `Executes a terminal command and returns the output
3535
36-The command will be executed from the current working directory: ${process.cwd()}
36+Commands are automatically executed from the current working directory (${process.cwd()}), so there's no need to change directories with 'cd' commands.
3737 `,
3838 parameters: {
3939 command: {