|
10 | 10 | - 'docs/api/testing/**' |
11 | 11 | - 'docs/_quartodoc-testing.yml' |
12 | 12 |
|
| 13 | +permissions: |
| 14 | + contents: write |
| 15 | + pull-requests: write |
| 16 | + |
13 | 17 | jobs: |
14 | 18 | update-testing-docs: |
15 | 19 | runs-on: ubuntu-latest |
| 20 | + if: github.event_name == 'push' |
16 | 21 |
|
17 | 22 | steps: |
18 | 23 | - name: Checkout repository |
@@ -47,16 +52,42 @@ jobs: |
47 | 52 | repomix docs/api/testing -o shiny/testing/utils/scripts/repomix-output-testing.xml |
48 | 53 | 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 |
49 | 54 |
|
50 | | - - name: Check for changes |
| 55 | + - name: Check for documentation changes |
51 | 56 | id: git-check |
52 | 57 | run: | |
53 | | - git diff --exit-code || echo "changes=true" >> $GITHUB_OUTPUT |
| 58 | + # Check if documentation_testing.json has changes |
| 59 | + if git diff --exit-code shiny/testing/generator/data/docs/documentation_testing.json; then |
| 60 | + echo "changes=false" >> $GITHUB_OUTPUT |
| 61 | + echo "No changes detected in documentation_testing.json" |
| 62 | + else |
| 63 | + echo "changes=true" >> $GITHUB_OUTPUT |
| 64 | + echo "Changes detected in documentation_testing.json" |
| 65 | + fi |
54 | 66 |
|
55 | | - - name: Commit and push changes |
56 | | - if: steps.git-check.outputs.changes == 'true' |
| 67 | + - name: Clean up temporary files |
57 | 68 | run: | |
58 | | - git config --local user.email "[email protected]" |
59 | | - git config --local user.name "GitHub Action" |
60 | | - git add . |
61 | | - git commit -m "Auto-update testing documentation" || exit 0 |
62 | | - git push |
| 69 | + # Remove temporary XML files |
| 70 | + rm -f shiny/testing/utils/scripts/repomix-output-testing.xml |
| 71 | +
|
| 72 | + - name: Create Pull Request |
| 73 | + if: steps.git-check.outputs.changes == 'true' |
| 74 | + uses: peter-evans/create-pull-request@v7 |
| 75 | + with: |
| 76 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 77 | + commit-message: "Auto-update testing documentation" |
| 78 | + title: "🤖 Auto-update testing documentation" |
| 79 | + body: | |
| 80 | + This PR was automatically generated to update the testing documentation. |
| 81 | +
|
| 82 | + **Changes:** |
| 83 | + - Updated `shiny/testing/generator/data/docs/documentation_testing.json` |
| 84 | +
|
| 85 | + **Triggered by:** |
| 86 | + - Changes to testing documentation in `docs/api/testing/` |
| 87 | + - Changes to `docs/_quartodoc-testing.yml` |
| 88 | +
|
| 89 | + Please review the changes before merging. |
| 90 | + branch: auto-update-testing-docs |
| 91 | + delete-branch: true |
| 92 | + add-paths: | |
| 93 | + shiny/testing/generator/data/docs/documentation_testing.json |
0 commit comments