serve documentation preview in PR #60
This file contains 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: serve documentation preview in PR | |
on: | |
workflow_run: | |
workflows: [sphinx] | |
types: [completed] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: {} | |
jobs: | |
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@v4 | |
- name: Download HTML artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: sphinx-html-artifact | |
path: html/ | |
github-token: ${{ github.token }} | |
run-id: ${{ github.event.workflow_run.id }} | |
- name: Acquire PR context | |
id: acquire-pr-context | |
uses: ./.github/actions/workflow-run/context | |
- name: Serve documentation preview | |
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 | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
number: ${{ steps.acquire-pr-context.outputs.pr-number }} | |
header: documentation-preview | |
message: >- | |
[Documentation preview](${{ vars.DOCUMENTATION_PREVIEW_URL }}/${{ steps.acquire-pr-context.outputs.pr-number }}) | |
@ ${{ steps.acquire-pr-context.outputs.pr-head-sha }} |