|
2 | 2 | # Created with Claude Code assistance |
3 | 3 | # |
4 | 4 | # Summary: |
5 | | -# ┌─────────────────────────────────┬───────────────────────┬──────────────────────────────┐ |
6 | | -# │ CodeRabbit Comment Contains │ Current Label │ Action │ |
7 | | -# ├─────────────────────────────────┼───────────────────────┼──────────────────────────────┤ |
8 | | -# │ "Run smoke tests: True" │ None │ ✅ Add 'smoke-tests:pending' │ |
9 | | -# │ "Run smoke tests: True" │ Already has label │ ✅ No-op (safe) │ |
10 | | -# │ "Run smoke tests: False" │ Has label │ ✅ Remove label │ |
11 | | -# │ "Run smoke tests: False" │ None │ ✅ No action │ |
12 | | -# │ Neither pattern │ Any │ ⏭️ No action │ |
13 | | -# │ Comment not from CodeRabbit │ Any │ ⏭️ Does NOT run │ |
14 | | -# └─────────────────────────────────┴───────────────────────┴──────────────────────────────┘ |
| 5 | +# ┌──────────────────────────────────────────────────────────────┬───────────────────────┬──────────────────────────────┐ |
| 6 | +# │ CodeRabbit Comment Contains │ Current Label │ Action │ |
| 7 | +# ├──────────────────────────────────────────────────────────────┼───────────────────────┼──────────────────────────────┤ |
| 8 | +# │ "Run smoke tests: True" AND "Test Execution Plan" │ None │ ✅ Add 'smoke-tests:pending' │ |
| 9 | +# │ "Run smoke tests: True" AND "Test Execution Plan" │ Already has label │ ✅ No-op (safe) │ |
| 10 | +# │ "Run smoke tests: False" AND "Test Execution Plan" │ Has label │ ✅ Remove label │ |
| 11 | +# │ "Run smoke tests: False" AND "Test Execution Plan" │ None │ ✅ No action │ |
| 12 | +# │ Missing "Test Execution Plan" │ Any │ ⏭️ No action │ |
| 13 | +# │ Neither pattern │ Any │ ⏭️ No action │ |
| 14 | +# │ Comment not from CodeRabbit │ Any │ ⏭️ Does NOT run │ |
| 15 | +# └──────────────────────────────────────────────────────────────┴───────────────────────┴──────────────────────────────┘ |
15 | 16 |
|
16 | 17 | name: "Smoke Tests Label from CodeRabbit" |
17 | 18 |
|
@@ -43,40 +44,49 @@ jobs: |
43 | 44 | echo "==========================================" |
44 | 45 | echo "Comment Author: ${{ github.event.comment.user.login }}" |
45 | 46 | echo "" |
| 47 | + echo "Comment Body (first 100 chars):" |
| 48 | + echo "${{ github.event.comment.body }}" | head -c 100 |
| 49 | + echo "" |
46 | 50 | echo "==========================================" |
47 | 51 | echo "Condition Matching Results" |
48 | 52 | echo "==========================================" |
49 | | - echo "Is author 'coderabbitai'? ${{ github.event.comment.user.login == 'coderabbitai' }}" |
50 | | - echo "Is author 'coderabbitai[bot]'? ${{ github.event.comment.user.login == 'coderabbitai[bot]' }}" |
51 | | - echo "Contains 'coderabbit' in author? ${{ contains(github.event.comment.user.login, 'coderabbit') }}" |
52 | | - echo "" |
| 53 | + echo "Contains 'Test Execution Plan'? ${{ contains(github.event.comment.body, 'Test Execution Plan') }}" |
53 | 54 | echo "Contains 'Run smoke tests: True'? ${{ contains(github.event.comment.body, 'Run smoke tests: True') }}" |
54 | 55 | echo "Contains 'Run smoke tests: False'? ${{ contains(github.event.comment.body, 'Run smoke tests: False') }}" |
| 56 | + echo "" |
| 57 | + echo "==========================================" |
| 58 | + echo "Action Determination" |
55 | 59 | echo "==========================================" |
| 60 | + HAS_TEST_PLAN="${{ contains(github.event.comment.body, 'Test Execution Plan') }}" |
| 61 | + HAS_RUN_TRUE="${{ contains(github.event.comment.body, 'Run smoke tests: True') }}" |
| 62 | + HAS_RUN_FALSE="${{ contains(github.event.comment.body, 'Run smoke tests: False') }}" |
56 | 63 |
|
57 | | - - name: Add smoke-tests:pending label |
58 | | - if: "contains(github.event.comment.body, 'Run smoke tests: True')" |
59 | | - run: echo "▶️ Adding 'smoke-tests:pending' label (comment indicates smoke tests should run)" |
| 64 | + if [ "$HAS_TEST_PLAN" = "true" ] && [ "$HAS_RUN_TRUE" = "true" ]; then |
| 65 | + echo "ACTION: ✅ Will ADD smoke-tests:pending label" |
| 66 | + elif [ "$HAS_TEST_PLAN" = "true" ] && [ "$HAS_RUN_FALSE" = "true" ]; then |
| 67 | + echo "ACTION: ✅ Will REMOVE smoke-tests:pending label" |
| 68 | + else |
| 69 | + echo "ACTION: ⏭️ No label change (missing Test Execution Plan or smoke test directive)" |
| 70 | + fi |
| 71 | + echo "==========================================" |
60 | 72 |
|
61 | | - - name: Execute add label action |
62 | | - if: "contains(github.event.comment.body, 'Run smoke tests: True')" |
| 73 | + - name: Add smoke-tests:pending label |
| 74 | + if: "contains(github.event.comment.body, 'Run smoke tests: True') && contains(github.event.comment.body, 'Test Execution Plan')" |
63 | 75 | uses: actions-ecosystem/action-add-labels@v1 |
64 | 76 | with: |
65 | 77 | labels: smoke-tests:pending |
66 | 78 | github_token: ${{ secrets.GITHUB_TOKEN }} |
67 | 79 |
|
68 | 80 | - name: Remove smoke-tests:pending label |
69 | | - if: "contains(github.event.comment.body, 'Run smoke tests: False')" |
70 | | - run: echo "▶️ Removing 'smoke-tests:pending' label (comment indicates smoke tests should NOT run)" |
71 | | - |
72 | | - - name: Execute remove label action |
73 | | - if: "contains(github.event.comment.body, 'Run smoke tests: False')" |
| 81 | + if: "contains(github.event.comment.body, 'Run smoke tests: False') && contains(github.event.comment.body, 'Test Execution Plan')" |
74 | 82 | uses: actions-ecosystem/action-remove-labels@v1 |
75 | 83 | continue-on-error: true # Ignore error if label doesn't exist |
76 | 84 | with: |
77 | 85 | labels: smoke-tests:pending |
78 | 86 | github_token: ${{ secrets.GITHUB_TOKEN }} |
79 | 87 |
|
80 | 88 | - name: No action needed |
81 | | - if: "!contains(github.event.comment.body, 'Run smoke tests: True') && !contains(github.event.comment.body, 'Run smoke tests: False')" |
82 | | - run: echo "⏭️ No action needed - comment does not contain smoke test directive" |
| 89 | + if: | |
| 90 | + !contains(github.event.comment.body, 'Test Execution Plan') || |
| 91 | + (!contains(github.event.comment.body, 'Run smoke tests: True') && !contains(github.event.comment.body, 'Run smoke tests: False')) |
| 92 | + run: echo "⏭️ No action needed - comment does not contain smoke test directive or Test Execution Plan" |
0 commit comments