Changesets · Branches · Tags · Compare
| Changeset | d3cfa8dd8581571547303639b3dc72c6d31c2c0ad6fadbc3cf8178412e98b828 |
|---|---|
| Author | Nate Sesti <33237525+sestinj@users.noreply.github.com> · 2025-09-24 23:25 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-09-24 23:25 -07:00 |
| Parents | f9c8d87df363 |
1 file changed
deleted .github/workflows/respond-to-cubic.yaml +0 −302
| @@ -1,302 +0,0 @@ | ||
| 1 | -name: Respond to @continuedev Comments | |
| 2 | - | |
| 3 | -on: | |
| 4 | - issue_comment: | |
| 5 | - types: [created] | |
| 6 | - pull_request_review_comment: | |
| 7 | - types: [created] | |
| 8 | - | |
| 9 | -permissions: | |
| 10 | - contents: write | |
| 11 | - pull-requests: write | |
| 12 | - issues: write | |
| 13 | - | |
| 14 | -jobs: | |
| 15 | - respond-to-comment: | |
| 16 | - # Only run on pull request comments | |
| 17 | - if: github.event_name == 'issue_comment' && github.event.issue.pull_request | |
| 18 | - runs-on: ubuntu-latest | |
| 19 | - | |
| 20 | - steps: | |
| 21 | - - name: Check if comment contains @continuedev | |
| 22 | - id: check-mention | |
| 23 | - run: | | |
| 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 | |
| 30 | - echo "contains_mention=true" >> $GITHUB_OUTPUT | |
| 31 | - else | |
| 32 | - echo "contains_mention=false" >> $GITHUB_OUTPUT | |
| 33 | - fi | |
| 34 | - | |
| 35 | - - name: Add eyes reaction to comment | |
| 36 | - if: steps.check-mention.outputs.contains_mention == 'true' | |
| 37 | - uses: actions/github-script@v8 | |
| 38 | - with: | |
| 39 | - script: | | |
| 40 | - await github.rest.reactions.createForIssueComment({ | |
| 41 | - owner: context.repo.owner, | |
| 42 | - repo: context.repo.repo, | |
| 43 | - comment_id: ${{ github.event.comment.id }}, | |
| 44 | - content: 'eyes' | |
| 45 | - }); | |
| 46 | - | |
| 47 | - - name: Checkout PR branch | |
| 48 | - if: steps.check-mention.outputs.contains_mention == 'true' | |
| 49 | - uses: actions/checkout@v5 | |
| 50 | - with: | |
| 51 | - token: ${{ secrets.GITHUB_TOKEN }} | |
| 52 | - fetch-depth: 0 | |
| 53 | - | |
| 54 | - - name: Get PR information | |
| 55 | - if: steps.check-mention.outputs.contains_mention == 'true' | |
| 56 | - id: pr-info | |
| 57 | - uses: actions/github-script@v8 | |
| 58 | - with: | |
| 59 | - script: | | |
| 60 | - const { data: pr } = await github.rest.pulls.get({ | |
| 61 | - owner: context.repo.owner, | |
| 62 | - repo: context.repo.repo, | |
| 63 | - pull_number: context.issue.number | |
| 64 | - }); | |
| 65 | - | |
| 66 | - core.setOutput('head_ref', pr.head.ref); | |
| 67 | - core.setOutput('head_sha', pr.head.sha); | |
| 68 | - return pr; | |
| 69 | - | |
| 70 | - - name: Checkout PR branch | |
| 71 | - if: steps.check-mention.outputs.contains_mention == 'true' | |
| 72 | - run: | | |
| 73 | - git checkout ${{ steps.pr-info.outputs.head_ref }} | |
| 74 | - | |
| 75 | - - name: Setup Node.js | |
| 76 | - if: steps.check-mention.outputs.contains_mention == 'true' | |
| 77 | - uses: actions/setup-node@v5 | |
| 78 | - with: | |
| 79 | - node-version: "20" | |
| 80 | - | |
| 81 | - - name: Install Continue CLI globally | |
| 82 | - if: steps.check-mention.outputs.contains_mention == 'true' | |
| 83 | - run: npm i -g @continuedev/cli | |
| 84 | - | |
| 85 | - - name: Start remote session | |
| 86 | - if: steps.check-mention.outputs.contains_mention == 'true' | |
| 87 | - id: remote-session | |
| 88 | - env: | |
| 89 | - CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} | |
| 90 | - run: | | |
| 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 }}: | |
| 94 | - | |
| 95 | - ${{ github.event.comment.body }} | |
| 96 | - | |
| 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 | |
| 103 | - | |
| 104 | - # Start remote session and capture JSON output | |
| 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 }}) | |
| 107 | - echo "Raw session output: $SESSION_OUTPUT" | |
| 108 | - | |
| 109 | - # Extract URL from JSON output | |
| 110 | - SESSION_URL=$(echo "$SESSION_OUTPUT" | jq -r '.url // empty') | |
| 111 | - | |
| 112 | - if [ -z "$SESSION_URL" ] || [ "$SESSION_URL" = "null" ]; then | |
| 113 | - echo "Failed to extract session URL from output: $SESSION_OUTPUT" | |
| 114 | - exit 1 | |
| 115 | - fi | |
| 116 | - | |
| 117 | - echo "session_url=$SESSION_URL" >> $GITHUB_OUTPUT | |
| 118 | - echo "✅ Started remote session: $SESSION_URL" | |
| 119 | - | |
| 120 | - - name: Comment with session URL | |
| 121 | - if: steps.check-mention.outputs.contains_mention == 'true' && steps.remote-session.outputs.session_url | |
| 122 | - uses: actions/github-script@v8 | |
| 123 | - env: | |
| 124 | - ORIGINAL_COMMENT: ${{ github.event.comment.body }} | |
| 125 | - with: | |
| 126 | - script: | | |
| 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; | |
| 130 | - | |
| 131 | - await github.rest.issues.createComment({ | |
| 132 | - owner: context.repo.owner, | |
| 133 | - repo: context.repo.repo, | |
| 134 | - issue_number: context.issue.number, | |
| 135 | - body: commentBody | |
| 136 | - }); | |
| 137 | - | |
| 138 | - - name: Log session details | |
| 139 | - if: steps.check-mention.outputs.contains_mention == 'true' | |
| 140 | - run: | | |
| 141 | - echo "✅ Successfully started remote session for comment from ${{ github.event.comment.user.login }} on PR #${{ github.event.issue.number }}" | |
| 142 | - echo "Session URL: ${{ steps.remote-session.outputs.session_url }}" | |
| 143 | - echo "Original comment:" | |
| 144 | - cat /tmp/comment.txt | |
| 145 | - | |
| 146 | - respond-to-review-comment: | |
| 147 | - # Only run on pull request review comments | |
| 148 | - if: github.event_name == 'pull_request_review_comment' | |
| 149 | - runs-on: ubuntu-latest | |
| 150 | - | |
| 151 | - steps: | |
| 152 | - - name: Check if comment contains @continuedev | |
| 153 | - id: check-mention | |
| 154 | - run: | | |
| 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 | |
| 161 | - echo "contains_mention=true" >> $GITHUB_OUTPUT | |
| 162 | - else | |
| 163 | - echo "contains_mention=false" >> $GITHUB_OUTPUT | |
| 164 | - fi | |
| 165 | - | |
| 166 | - - name: Add eyes reaction to comment | |
| 167 | - if: steps.check-mention.outputs.contains_mention == 'true' | |
| 168 | - uses: actions/github-script@v8 | |
| 169 | - with: | |
| 170 | - script: | | |
| 171 | - await github.rest.reactions.createForPullRequestReviewComment({ | |
| 172 | - owner: context.repo.owner, | |
| 173 | - repo: context.repo.repo, | |
| 174 | - comment_id: ${{ github.event.comment.id }}, | |
| 175 | - content: 'eyes' | |
| 176 | - }); | |
| 177 | - | |
| 178 | - - name: Checkout PR branch | |
| 179 | - if: steps.check-mention.outputs.contains_mention == 'true' | |
| 180 | - uses: actions/checkout@v5 | |
| 181 | - with: | |
| 182 | - token: ${{ secrets.GITHUB_TOKEN }} | |
| 183 | - fetch-depth: 0 | |
| 184 | - ref: ${{ github.event.pull_request.head.ref }} | |
| 185 | - | |
| 186 | - - name: Setup Node.js | |
| 187 | - if: steps.check-mention.outputs.contains_mention == 'true' | |
| 188 | - uses: actions/setup-node@v5 | |
| 189 | - with: | |
| 190 | - node-version: "20" | |
| 191 | - | |
| 192 | - - name: Install Continue CLI globally | |
| 193 | - if: steps.check-mention.outputs.contains_mention == 'true' | |
| 194 | - run: npm i -g @continuedev/cli | |
| 195 | - | |
| 196 | - - name: Get review context | |
| 197 | - if: steps.check-mention.outputs.contains_mention == 'true' | |
| 198 | - id: review-context | |
| 199 | - uses: actions/github-script@v8 | |
| 200 | - with: | |
| 201 | - script: | | |
| 202 | - let reviewContext = ''; | |
| 203 | - | |
| 204 | - // Check if this comment is a reply to another review comment | |
| 205 | - if (context.payload.comment.in_reply_to_id) { | |
| 206 | - try { | |
| 207 | - const { data: originalComment } = await github.rest.pulls.getReviewComment({ | |
| 208 | - owner: context.repo.owner, | |
| 209 | - repo: context.repo.repo, | |
| 210 | - comment_id: context.payload.comment.in_reply_to_id | |
| 211 | - }); | |
| 212 | - | |
| 213 | - reviewContext = `**Original review comment by @${originalComment.user.login}:** | |
| 214 | - ${originalComment.body} | |
| 215 | - | |
| 216 | - **Reply by @${{ github.event.comment.user.login }}:** | |
| 217 | - ${{ github.event.comment.body }}`; | |
| 218 | - } catch (error) { | |
| 219 | - console.log('Could not fetch original comment, using current comment only'); | |
| 220 | - reviewContext = `**Review comment by @${{ github.event.comment.user.login }}:** | |
| 221 | - ${{ github.event.comment.body }}`; | |
| 222 | - } | |
| 223 | - } else { | |
| 224 | - reviewContext = `**Review comment by @${{ github.event.comment.user.login }}:** | |
| 225 | - ${{ github.event.comment.body }}`; | |
| 226 | - } | |
| 227 | - | |
| 228 | - core.setOutput('context', reviewContext); | |
| 229 | - | |
| 230 | - - name: Start remote session | |
| 231 | - if: steps.check-mention.outputs.contains_mention == 'true' | |
| 232 | - id: remote-session | |
| 233 | - env: | |
| 234 | - CONTINUE_API_KEY: ${{ secrets.CONTINUE_API_KEY }} | |
| 235 | - run: | | |
| 236 | - # Debug: Echo the branch we're starting the session on | |
| 237 | - echo "Starting remote session on branch: ${{ github.event.pull_request.head.ref }}" | |
| 238 | - | |
| 239 | - # Create a temporary file for the prompt to handle special characters and newlines properly | |
| 240 | - cat > /tmp/prompt.txt << 'PROMPT_EOF' | |
| 241 | - Please help with the following code review discussion from PR #${{ github.event.pull_request.number }}: | |
| 242 | - | |
| 243 | - **File:** ${{ github.event.comment.path }} | |
| 244 | - **Line:** ${{ github.event.comment.line || github.event.comment.original_line || 'N/A' }} | |
| 245 | - | |
| 246 | - ${{ steps.review-context.outputs.context }} | |
| 247 | - | |
| 248 | - 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. | |
| 249 | - PROMPT_EOF | |
| 250 | - | |
| 251 | - # Debug output | |
| 252 | - echo "PROMPT content:" | |
| 253 | - cat /tmp/prompt.txt | |
| 254 | - | |
| 255 | - # Start remote session and capture JSON output | |
| 256 | - echo "Starting cn with prompt..." | |
| 257 | - SESSION_OUTPUT=$(cat /tmp/prompt.txt | cn remote -s --config continuedev/address-code-review --branch ${{ github.event.pull_request.head.ref }}) | |
| 258 | - echo "Raw session output: $SESSION_OUTPUT" | |
| 259 | - | |
| 260 | - # Extract URL from JSON output | |
| 261 | - SESSION_URL=$(echo "$SESSION_OUTPUT" | jq -r '.url // empty') | |
| 262 | - | |
| 263 | - if [ -z "$SESSION_URL" ] || [ "$SESSION_URL" = "null" ]; then | |
| 264 | - echo "Failed to extract session URL from output: $SESSION_OUTPUT" | |
| 265 | - exit 1 | |
| 266 | - fi | |
| 267 | - | |
| 268 | - echo "session_url=$SESSION_URL" >> $GITHUB_OUTPUT | |
| 269 | - echo "✅ Started remote session: $SESSION_URL" | |
| 270 | - | |
| 271 | - - name: Comment with session URL | |
| 272 | - if: steps.check-mention.outputs.contains_mention == 'true' && steps.remote-session.outputs.session_url | |
| 273 | - uses: actions/github-script@v8 | |
| 274 | - env: | |
| 275 | - ORIGINAL_COMMENT: ${{ github.event.comment.body }} | |
| 276 | - with: | |
| 277 | - script: | | |
| 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; | |
| 281 | - | |
| 282 | - const commentParams = { | |
| 283 | - owner: context.repo.owner, | |
| 284 | - repo: context.repo.repo, | |
| 285 | - pull_number: ${{ github.event.pull_request.number }}, | |
| 286 | - body: commentBody, | |
| 287 | - commit_id: '${{ github.event.pull_request.head.sha }}', | |
| 288 | - path: '${{ github.event.comment.path }}', | |
| 289 | - in_reply_to: ${{ github.event.comment.id }} | |
| 290 | - }; | |
| 291 | - | |
| 292 | - await github.rest.pulls.createReviewComment(commentParams); | |
| 293 | - | |
| 294 | - - name: Log session details | |
| 295 | - if: steps.check-mention.outputs.contains_mention == 'true' | |
| 296 | - run: | | |
| 297 | - echo "✅ Successfully started remote session for review comment from ${{ github.event.comment.user.login }} on PR #${{ github.event.pull_request.number }}" | |
| 298 | - echo "Session URL: ${{ steps.remote-session.outputs.session_url }}" | |
| 299 | - echo "File: ${{ github.event.comment.path }}" | |
| 300 | - echo "Line: ${{ github.event.comment.line }}" | |
| 301 | - echo "Original comment:" | |
| 302 | - cat /tmp/review_comment.txt |