pr-serve-documentation-preview #4143
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: pr-serve-documentation-preview | |
| on: | |
| workflow_run: | |
| workflows: [sphinx] | |
| types: [completed] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: {} | |
| jobs: | |
| pr-serve-documentation-preview: | |
| if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: read | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| sparse-checkout: .github | |
| - name: Download HTML artifacts | |
| id: download-html-artifacts | |
| continue-on-error: True | |
| uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 | |
| with: | |
| name: sphinx-html-artifact | |
| path: html/ | |
| github-token: ${{ github.token }} | |
| run-id: ${{ github.event.workflow_run.id }} | |
| - name: Acquire PR context | |
| if: ${{ steps.download-html-artifacts.outcome == 'success' }} | |
| id: acquire-pr-context | |
| uses: ./.github/actions/workflow-run/context | |
| - name: Serve documentation preview | |
| if: ${{ steps.download-html-artifacts.outcome == 'success' }} | |
| uses: ./.github/actions/sphinx/deploy | |
| with: | |
| CONFIGURATION: ${{ secrets.RCLONE_CONFIG_DOC_PREVIEW }} | |
| BUCKET: ${{ vars.DOCUMENTATION_PREVIEW_BUCKET }} | |
| SOURCE: html/ | |
| DESTINATION: ${{ steps.acquire-pr-context.outputs.pr-number }}/ | |
| - name: Comment with documentation preview link | |
| if: ${{ steps.download-html-artifacts.outcome == 'success' }} | |
| uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4 | |
| with: | |
| number: ${{ steps.acquire-pr-context.outputs.pr-number }} | |
| header: documentation-preview | |
| message: >- | |
| [Documentation preview](https://${{ vars.DOCUMENTATION_PREVIEW_DOMAIN }}/${{ steps.acquire-pr-context.outputs.pr-number }}) | |
| @ ${{ steps.acquire-pr-context.outputs.pr-head-sha }} |