|
20 | 20 | name: 🔍 Route Comment |
21 | 21 | runs-on: ubuntu-latest |
22 | 22 | outputs: |
| 23 | + is_command_triggered: ${{ steps.route.outputs.is_command_triggered || 'false' }} |
23 | 24 | is_review: ${{ steps.route.outputs.is_review || 'false' }} |
24 | 25 | is_squash: ${{ steps.route.outputs.is_squash || 'false' }} |
25 | 26 | is_resolve: ${{ steps.route.outputs.is_resolve || 'false' }} |
|
45 | 46 | if echo "$BODY" | grep -qiE "^@gemini-enrich"; then echo "is_enrich=true" >> $GITHUB_OUTPUT; fi |
46 | 47 | if echo "$BODY" | grep -qiE "^@gemini-help"; then echo "is_help=true" >> $GITHUB_OUTPUT; fi |
47 | 48 |
|
| 49 | + init-status: |
| 50 | + needs: [router] |
| 51 | + if: needs.router.outputs.is_command_triggered == 'true' |
| 52 | + runs-on: ubuntu-latest |
| 53 | + outputs: |
| 54 | + comment_id: ${{ steps.post-comment.outputs.comment-id }} |
| 55 | + steps: |
| 56 | + - name: Post Initial Status |
| 57 | + id: post-comment |
| 58 | + uses: peter-evans/create-or-update-comment@v4 |
| 59 | + with: |
| 60 | + issue-number: ${{ github.event.issue.number }} |
| 61 | + body: | |
| 62 | + ### 🤖 Command Operation Status |
| 63 | +
|
| 64 | + ⏳ **Status:** In Progress... |
| 65 | +
|
| 66 | + Triggered by: @${{ github.actor }} via [comment](${{ github.event.comment.html_url }}) |
| 67 | +
|
| 68 | + <!-- id: comment-op-status-${{ github.event.comment.id }} --> |
| 69 | +
|
48 | 70 | execute-review: |
49 | 71 | needs: [router] |
50 | 72 | if: github.event.issue.pull_request && needs.router.outputs.is_review == 'true' |
@@ -267,3 +289,60 @@ jobs: |
267 | 289 | source_branch: ${{ needs.prepare-resolve.outputs.source_branch }} |
268 | 290 | pr_number: ${{ github.event.issue.number }} |
269 | 291 | secrets: inherit |
| 292 | + |
| 293 | + finalize-status: |
| 294 | + needs: |
| 295 | + - router |
| 296 | + - init-status |
| 297 | + - execute-review |
| 298 | + - execute-triage |
| 299 | + - execute-coder |
| 300 | + - execute-create-review-issues |
| 301 | + - execute-help |
| 302 | + - execute-squash |
| 303 | + - execute-resolve |
| 304 | + if: always() && needs.init-status.result == 'success' |
| 305 | + runs-on: ubuntu-latest |
| 306 | + steps: |
| 307 | + - name: Determine Final Status |
| 308 | + id: status |
| 309 | + run: | |
| 310 | + REPORT="### 🤖 Command Operation Status\n\n" |
| 311 | +
|
| 312 | + check_job() { |
| 313 | + local name=$1 |
| 314 | + local result=$2 |
| 315 | + local triggered=$3 |
| 316 | + if [ "$triggered" == "true" ]; then |
| 317 | + case $result in |
| 318 | + success) REPORT="${REPORT}✅ **$name:** Success\n" ;; |
| 319 | + failure) REPORT="${REPORT}❌ **$name:** Failed\n" ;; |
| 320 | + cancelled) REPORT="${REPORT}🚫 **$name:** Cancelled\n" ;; |
| 321 | + skipped) REPORT="${REPORT}⏭️ **$name:** Skipped\n" ;; |
| 322 | + *) REPORT="${REPORT}❓ **$name:** Unknown ($result)\n" ;; |
| 323 | + esac |
| 324 | + fi |
| 325 | + } |
| 326 | +
|
| 327 | + check_job "Review" "${{ needs.execute-review.result }}" "${{ needs.router.outputs.is_review }}" |
| 328 | + check_job "Triage" "${{ needs.execute-triage.result }}" "${{ needs.router.outputs.is_triage }}" |
| 329 | + check_job "Coder" "${{ needs.execute-coder.result }}" "${{ needs.router.outputs.is_coder }}" |
| 330 | + check_job "Create Review Issues (Manual)" "${{ needs.execute-create-review-issues.result }}" "${{ needs.router.outputs.is_review_issues }}" |
| 331 | +
|
| 332 | + check_job "Help" "${{ needs.execute-help.result }}" "${{ needs.router.outputs.is_help }}" |
| 333 | + check_job "Squash" "${{ needs.execute-squash.result }}" "${{ needs.router.outputs.is_squash }}" |
| 334 | + check_job "Resolve" "${{ needs.execute-resolve.result }}" "${{ needs.router.outputs.is_resolve }}" |
| 335 | +
|
| 336 | + REPORT="${REPORT}\n---\nTriggered by: @${{ github.actor }} via [comment](${{ github.event.comment.html_url }})" |
| 337 | + REPORT="${REPORT}\n\n<!-- id: comment-op-status-${{ github.event.comment.id }} -->" |
| 338 | +
|
| 339 | + echo "REPORT<<EOF" >> $GITHUB_OUTPUT |
| 340 | + printf "%b\n" "$REPORT" >> $GITHUB_OUTPUT |
| 341 | + echo "EOF" >> $GITHUB_OUTPUT |
| 342 | +
|
| 343 | + - name: Update Status Comment |
| 344 | + uses: peter-evans/create-or-update-comment@v4 |
| 345 | + with: |
| 346 | + comment-id: ${{ needs.init-status.outputs.comment_id }} |
| 347 | + body: ${{ steps.status.outputs.REPORT }} |
| 348 | + edit-mode: replace |
0 commit comments