|
| 1 | +# description: Add comment for CodeRabbit to add tests instructions. A change-request comment will be added to the PR. |
| 2 | + |
| 3 | +name: Request CodeRabbit tests instructions |
| 4 | + |
| 5 | +on: |
| 6 | + pull_request_target: |
| 7 | + types: [labeled] |
| 8 | + |
| 9 | +permissions: |
| 10 | + pull-requests: write |
| 11 | + contents: read |
| 12 | + |
| 13 | +jobs: |
| 14 | + comment-on-commit: |
| 15 | + if: | |
| 16 | + github.event.label.name == 'verified' && |
| 17 | + !contains(github.event.pull_request.user.login, 'renovate') |
| 18 | + runs-on: ubuntu-latest |
| 19 | + |
| 20 | + steps: |
| 21 | + - name: Check team membership |
| 22 | + id: check-user-team |
| 23 | + uses: tspascoal/get-user-teams-membership@v3 |
| 24 | + with: |
| 25 | + team: cnvqe-bot |
| 26 | + username: ${{ github.event.pull_request.user.login }} |
| 27 | + GITHUB_TOKEN: ${{ secrets.BOT3_TOKEN }} |
| 28 | + |
| 29 | + - name: Create or update comment |
| 30 | + if: steps.check-user-team.outputs.is-member != 'true' |
| 31 | + uses: peter-evans/create-or-update-comment@v4 |
| 32 | + with: |
| 33 | + issue-number: ${{ github.event.pull_request.number }} |
| 34 | + body: | |
| 35 | + @coderabbitai |
| 36 | + <details> |
| 37 | + <summary>Test execution plan request details</summary> |
| 38 | +
|
| 39 | + As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan. |
| 40 | + You will create a change request comment on the 1st line of the 1st file in the pr with the test execution plan. |
| 41 | + If you fail to run or post a comment, retry. |
| 42 | +
|
| 43 | + **Analysis Requirements:** |
| 44 | +
|
| 45 | + 1. Examine code changes in each modified file |
| 46 | + 2. Identify affected code paths, functions, and classes |
| 47 | + 3. Analyze pytest-specific elements: fixtures (scope, dependencies), parametrization, markers, conftest changes |
| 48 | + 4. Trace test dependencies through imports, shared utilities, and fixture inheritance |
| 49 | + 5. Detect new tests introduced in the PR |
| 50 | +
|
| 51 | + **Your deliverable:** |
| 52 | + Your change request comment will be based on the following requirements: |
| 53 | +
|
| 54 | + **Test Execution Plan** |
| 55 | +
|
| 56 | + - `path/to/test_file.py` - When the entire test file needs verification |
| 57 | + - `path/to/test_file.py::TestClass::test_method` - When specific test(s) needed |
| 58 | + - `path/to/test_file.py::test_function` - When specific test(s) needed |
| 59 | + - `-m marker` - When specific marker(s) can be used to cover multiple cases. |
| 60 | +
|
| 61 | + **Guidelines:** |
| 62 | +
|
| 63 | + - Include only tests directly affected by the changes |
| 64 | + - Use a full file path only if ALL tests in that file require verification |
| 65 | + - Use file path + test name if only specific tests are needed |
| 66 | + - If a test marker can cover multiple files/tests, provide the marker |
| 67 | + - Balance coverage vs over-testing - Keep descriptions minimal |
| 68 | + - Do not add a follow-up comment in the PR, only the change request one |
| 69 | +
|
| 70 | + </details> |
0 commit comments