Update Docs Submodule #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update Docs Submodule | |
| on: | |
| repository_dispatch: | |
| types: [docs-updated] | |
| workflow_dispatch: | |
| inputs: | |
| reason: | |
| description: 'Reason for manual trigger' | |
| required: false | |
| default: 'Manual update' | |
| permissions: | |
| contents: write | |
| jobs: | |
| update-submodule: | |
| runs-on: ubuntu-latest | |
| # Requires manual approval - configure "production" environment in repo settings | |
| # Settings > Environments > New environment > "production" > Add reviewers | |
| environment: production | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Update docs submodule | |
| run: | | |
| cd docs | |
| git fetch origin main | |
| git checkout origin/main | |
| cd .. | |
| - name: Check for changes | |
| id: check | |
| run: | | |
| if git diff --quiet; then | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| echo "No changes detected" | |
| else | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| echo "Changes detected in docs submodule" | |
| fi | |
| - name: Commit and push | |
| if: steps.check.outputs.changed == 'true' | |
| run: | | |
| git add docs | |
| git commit -m "chore: update docs submodule to latest | |
| Triggered by: ${{ github.event_name }} | |
| ${{ github.event.client_payload.message || inputs.reason || '' }}" | |
| git push |