|
8 | 8 | pull_request_review_comment: |
9 | 9 | types: [created] |
10 | 10 |
|
| 11 | +concurrency: |
| 12 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
11 | 15 | jobs: |
12 | 16 | comprehensive-review: |
13 | 17 | name: PR Description & Code Review |
|
30 | 34 | steps: |
31 | 35 | - name: Checkout repository |
32 | 36 | uses: actions/checkout@v4 |
| 37 | + |
| 38 | + - name: Delete Previous Claude Comments |
| 39 | + run: | |
| 40 | + echo "🧹 Deleting previous Claude comments from github-actions bot..." |
| 41 | + |
| 42 | + # Get all comments from github-actions bot containing 'Claude' |
| 43 | + CLAUDE_COMMENTS=$(gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \ |
| 44 | + --jq '[.[] | select(.user.login == "github-actions[bot]") | select(.body | contains("Claude")) | .id]') |
| 45 | + |
| 46 | + if [ "$CLAUDE_COMMENTS" = "[]" ] || [ -z "$CLAUDE_COMMENTS" ]; then |
| 47 | + echo "No previous Claude comments found" |
| 48 | + else |
| 49 | + echo "Found Claude comments to delete:" |
| 50 | + echo "$CLAUDE_COMMENTS" | jq -r '.[]' | while read comment_id; do |
| 51 | + echo "Deleting comment $comment_id" |
| 52 | + gh api repos/${{ github.repository }}/issues/comments/$comment_id -X DELETE || echo "Failed to delete comment $comment_id" |
| 53 | + done |
| 54 | + echo "✅ Deleted previous Claude comments" |
| 55 | + fi |
| 56 | + env: |
| 57 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 58 | + continue-on-error: true |
| 59 | + |
33 | 60 | - name: Detect Critical Paths |
34 | 61 | id: critical_paths |
35 | 62 | run: | |
@@ -147,41 +174,3 @@ jobs: |
147 | 174 | --max-turns ${{ steps.critical_paths.outputs.is_critical == 'true' && '90' || '65' }} |
148 | 175 | --model claude-sonnet-4-5-20250929 |
149 | 176 | |
150 | | - - name: Intelligent Comment Cleanup |
151 | | - uses: anthropics/claude-code-action@v1 |
152 | | - if: always() |
153 | | - with: |
154 | | - github_token: ${{ secrets.GITHUB_TOKEN }} |
155 | | - anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} |
156 | | - prompt: | |
157 | | - Clean up stale bot comments on PR #${{ github.event.pull_request.number }}. |
158 | | - |
159 | | - **Task:** |
160 | | - 1. Fetch all comments on this PR |
161 | | - 2. Identify bot comments (users ending in [bot]) that are stale/outdated: |
162 | | - - Old reviews superseded by newer ones |
163 | | - - Old PR description suggestions |
164 | | - - Previously collapsed/outdated markers |
165 | | - - Progress/status comments from previous workflow runs |
166 | | - 3. Keep only the most recent comment per category per bot |
167 | | - 4. DELETE all stale comments (do not collapse) |
168 | | - |
169 | | - **Get all comments:** |
170 | | - ```bash |
171 | | - gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments --jq '.[] | {id, user: .user.login, body, created_at}' |
172 | | - ``` |
173 | | - |
174 | | - **Delete a comment:** |
175 | | - ```bash |
176 | | - gh api repos/${{ github.repository }}/issues/comments/COMMENT_ID -X DELETE |
177 | | - ``` |
178 | | - |
179 | | - Be intelligent: |
180 | | - - Preserve the newest useful comment in each category |
181 | | - - Delete everything else that's redundant or stale |
182 | | - - If unsure, keep the comment (conservative approach) |
183 | | - |
184 | | - claude_args: | |
185 | | - --allowed-tools "Bash(gh api repos/*/issues/*/comments:*),Bash(gh api repos/*/issues/comments/*:*)" |
186 | | - --max-turns 8 |
187 | | - --model claude-haiku-4-5-20251001 |
0 commit comments