|
| 1 | +name: Validate Testing Documentation |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: |
| 6 | + - 'docs/_quartodoc-testing.yml' |
| 7 | + - 'shiny/playwright/controller/**' |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + pull-requests: write |
| 12 | + |
| 13 | +jobs: |
| 14 | + validate-controller-changes: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + if: github.event_name == 'pull_request' |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout repository |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + fetch-depth: 0 |
| 23 | + |
| 24 | + - name: Check for controller changes |
| 25 | + id: check-controller |
| 26 | + run: | |
| 27 | + # Check if any files in shiny/playwright/controller have changed |
| 28 | + if git diff --name-only origin/${{ github.base_ref }}...HEAD | grep -q '^shiny/playwright/controller/'; then |
| 29 | + echo "controller_changed=true" >> $GITHUB_OUTPUT |
| 30 | + echo "Changes detected in shiny/playwright/controller directory" |
| 31 | + else |
| 32 | + echo "controller_changed=false" >> $GITHUB_OUTPUT |
| 33 | + echo "No changes detected in shiny/playwright/controller directory" |
| 34 | + fi |
| 35 | +
|
| 36 | + - name: Comment on PR about testing docs update |
| 37 | + if: steps.check-controller.outputs.controller_changed == 'true' |
| 38 | + uses: marocchino/sticky-pull-request-comment@v2 |
| 39 | + with: |
| 40 | + header: testing-docs-update |
| 41 | + message: | |
| 42 | + 🤖 **Testing Documentation Update Required** |
| 43 | +
|
| 44 | + We detected changes in the `shiny/playwright/controller` directory. These changes may affect the testing documentation used by the `shiny add test` command. |
| 45 | +
|
| 46 | + **Please run the following commands to update the testing documentation:** |
| 47 | +
|
| 48 | + ```bash |
| 49 | + # Install repomix if not already installed |
| 50 | + npm install -g repomix |
| 51 | +
|
| 52 | + # Generate updated testing documentation |
| 53 | + repomix docs/api/testing -o shiny/testing/utils/scripts/repomix-output-testing.xml |
| 54 | + python shiny/testing/utils/scripts/process_docs.py --input shiny/testing/utils/scripts/repomix-output-testing.xml --output shiny/testing/generator/data/docs/documentation_testing.json |
| 55 | +
|
| 56 | + # Clean up temporary files |
| 57 | + rm -f shiny/testing/utils/scripts/repomix-output-testing.xml |
| 58 | + ``` |
| 59 | +
|
| 60 | + This will ensure that the AI test generator has access to the latest controller API documentation. |
| 61 | +
|
| 62 | + --- |
| 63 | + *This comment was automatically generated by the validate_testing_docs workflow.* |
| 64 | +
|
| 65 | + - name: Remove comment when no controller changes |
| 66 | + if: steps.check-controller.outputs.controller_changed == 'false' |
| 67 | + uses: marocchino/sticky-pull-request-comment@v2 |
| 68 | + with: |
| 69 | + header: testing-docs-update |
| 70 | + delete: true |
0 commit comments