Changesets · Branches · Tags · Compare
| Changeset | fbf24da2248c313b946ab1c65fe49acdfa7a7956b7ecdeb51a9767a46016fcfb |
|---|---|
| Author | Nate <sestinj@gmail.com> · 2025-09-14 15:53 -07:00 |
| Committer | Nate <sestinj@gmail.com> · 2025-09-14 15:53 -07:00 |
| Parents | 991ff92b576b |
1 file changed
modified .github/workflows/respond-to-cubic.yaml +37 −12
| @@ -21,7 +21,12 @@ | ||
| 21 | 21 | - name: Check if comment contains @continuedev |
| 22 | 22 | id: check-mention |
| 23 | 23 | run: | |
| 24 | - if echo "${{ github.event.comment.body }}" | grep -q "@continuedev"; then | |
| 24 | + # Create a temporary file to safely handle comment body with special characters | |
| 25 | + cat > /tmp/comment.txt << 'COMMENT_EOF' | |
| 26 | + ${{ github.event.comment.body }} | |
| 27 | + COMMENT_EOF | |
| 28 | + | |
| 29 | + if grep -q "@continuedev" /tmp/comment.txt; then | |
| 25 | 30 | echo "contains_mention=true" >> $GITHUB_OUTPUT |
| 26 | 31 | else |
| 27 | 32 | echo "contains_mention=false" >> $GITHUB_OUTPUT |
| @@ -83,15 +88,22 @@ | ||
| 83 | 88 | env: |
| 84 | 89 | CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} |
| 85 | 90 | run: | |
| 86 | - # Create the prompt for remote session | |
| 87 | - PROMPT="Please help with the following request from @${{ github.event.comment.user.login }} on PR #${{ github.event.issue.number }}: | |
| 91 | + # Create a temporary file for the prompt to handle special characters and newlines properly | |
| 92 | + cat > /tmp/prompt.txt << 'PROMPT_EOF' | |
| 93 | + Please help with the following request from @${{ github.event.comment.user.login }} on PR #${{ github.event.issue.number }}: | |
| 88 | 94 | |
| 89 | 95 | ${{ github.event.comment.body }} |
| 90 | 96 | |
| 91 | - Please analyze the current PR, understand the request, implement the necessary changes, and commit them to this branch." | |
| 97 | + Please analyze the current PR, understand the request, implement the necessary changes, and commit them to this branch. | |
| 98 | + PROMPT_EOF | |
| 99 | + | |
| 100 | + # Debug output | |
| 101 | + echo "PROMPT content:" | |
| 102 | + cat /tmp/prompt.txt | |
| 92 | 103 | |
| 93 | 104 | # Start remote session and capture JSON output |
| 94 | - SESSION_OUTPUT=$(echo "$PROMPT" | cn remote -s --config continuedev/address-code-review --branch ${{ steps.pr-info.outputs.head_ref }}) | |
| 105 | + echo "Starting cn with prompt..." | |
| 106 | + SESSION_OUTPUT=$(cat /tmp/prompt.txt | cn remote -s --config continuedev/address-code-review --branch ${{ steps.pr-info.outputs.head_ref }}) | |
| 95 | 107 | echo "Raw session output: $SESSION_OUTPUT" |
| 96 | 108 | |
| 97 | 109 | # Extract URL from JSON output |
| @@ -108,10 +120,13 @@ | ||
| 108 | 120 | - name: Comment with session URL |
| 109 | 121 | if: steps.check-mention.outputs.contains_mention == 'true' && steps.remote-session.outputs.session_url |
| 110 | 122 | uses: actions/github-script@v8 |
| 123 | + env: | |
| 124 | + ORIGINAL_COMMENT: ${{ github.event.comment.body }} | |
| 111 | 125 | with: |
| 112 | 126 | script: | |
| 113 | - const commentBody = `I've started [a remote session](${{ steps.remote-session.outputs.session_url }}) to help with your request: | |
| 114 | - > ${{ github.event.comment.body }}`; | |
| 127 | + const sessionUrl = '${{ steps.remote-session.outputs.session_url }}'; | |
| 128 | + const originalComment = process.env.ORIGINAL_COMMENT; | |
| 129 | + const commentBody = "I've started [a remote session](" + sessionUrl + ") to help with your request:\n> " + originalComment; | |
| 115 | 130 | |
| 116 | 131 | await github.rest.issues.createComment({ |
| 117 | 132 | owner: context.repo.owner, |
| @@ -125,7 +140,8 @@ | ||
| 125 | 140 | run: | |
| 126 | 141 | echo "✅ Successfully started remote session for comment from ${{ github.event.comment.user.login }} on PR #${{ github.event.issue.number }}" |
| 127 | 142 | echo "Session URL: ${{ steps.remote-session.outputs.session_url }}" |
| 128 | - echo "Original comment: ${{ github.event.comment.body }}" | |
| 143 | + echo "Original comment:" | |
| 144 | + cat /tmp/comment.txt | |
| 129 | 145 | |
| 130 | 146 | respond-to-review-comment: |
| 131 | 147 | # Only run on pull request review comments |
| @@ -136,7 +152,12 @@ | ||
| 136 | 152 | - name: Check if comment contains @continuedev |
| 137 | 153 | id: check-mention |
| 138 | 154 | run: | |
| 139 | - if echo "${{ github.event.comment.body }}" | grep -q "@continuedev"; then | |
| 155 | + # Create a temporary file to safely handle comment body with special characters | |
| 156 | + cat > /tmp/review_comment.txt << 'COMMENT_EOF' | |
| 157 | + ${{ github.event.comment.body }} | |
| 158 | + COMMENT_EOF | |
| 159 | + | |
| 160 | + if grep -q "@continuedev" /tmp/review_comment.txt; then | |
| 140 | 161 | echo "contains_mention=true" >> $GITHUB_OUTPUT |
| 141 | 162 | else |
| 142 | 163 | echo "contains_mention=false" >> $GITHUB_OUTPUT |
| @@ -250,10 +271,13 @@ | ||
| 250 | 271 | - name: Comment with session URL |
| 251 | 272 | if: steps.check-mention.outputs.contains_mention == 'true' && steps.remote-session.outputs.session_url |
| 252 | 273 | uses: actions/github-script@v8 |
| 274 | + env: | |
| 275 | + ORIGINAL_COMMENT: ${{ github.event.comment.body }} | |
| 253 | 276 | with: |
| 254 | 277 | script: | |
| 255 | - const commentBody = `I've started [a remote session](${{ steps.remote-session.outputs.session_url }}) to help with your request: | |
| 256 | - > ${{ github.event.comment.body }}`; | |
| 278 | + const sessionUrl = '${{ steps.remote-session.outputs.session_url }}'; | |
| 279 | + const originalComment = process.env.ORIGINAL_COMMENT; | |
| 280 | + const commentBody = "I've started [a remote session](" + sessionUrl + ") to help with your request:\n> " + originalComment; | |
| 257 | 281 | |
| 258 | 282 | const commentParams = { |
| 259 | 283 | owner: context.repo.owner, |
| @@ -274,4 +298,5 @@ | ||
| 274 | 298 | echo "Session URL: ${{ steps.remote-session.outputs.session_url }}" |
| 275 | 299 | echo "File: ${{ github.event.comment.path }}" |
| 276 | 300 | echo "Line: ${{ github.event.comment.line }}" |
| 277 | - echo "Original comment: ${{ github.event.comment.body }}" | |
| 301 | + echo "Original comment:" | |
| 302 | + cat /tmp/review_comment.txt |