diff --git a/.github/workflows/docbuild-and-upload.yml b/.github/workflows/docbuild-and-upload.yml index 73e59134c904a..d2df75777e049 100644 --- a/.github/workflows/docbuild-and-upload.yml +++ b/.github/workflows/docbuild-and-upload.yml @@ -89,3 +89,10 @@ jobs: name: website path: web/build retention-days: 14 + + - name: Trigger web/doc preview + run: curl -X POST https://pandas.pydata.org/preview/submit/$RUN_ID/$PR_ID/ + env: + RUN_ID: ${{ github.run_id }} + PR_ID: ${{ github.event.pull_request.number }} + if: github.event_name == 'pull_request' diff --git a/.github/workflows/preview-docs.yml b/.github/workflows/preview-docs.yml new file mode 100644 index 0000000000000..8f73db283289c --- /dev/null +++ b/.github/workflows/preview-docs.yml @@ -0,0 +1,22 @@ +name: Preview docs +on: + issue_comment: + types: created + +permissions: + contents: read + +jobs: + preview_docs: + permissions: + issues: write + pull-requests: write + runs-on: ubuntu-22.04 + steps: + - if: github.event.comment.body == '/preview' + run: | + if curl --output /dev/null --silent --head --fail "https://pandas.pydata.org/preview/${{ github.event.issue.number }}/"; then + curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -d '{"body": "Website preview of this PR available at: https://pandas.pydata.org/preview/${{ github.event.issue.number }}/"}' https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments + else + curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -d '{"body": "No preview found for PR #${{ github.event.issue.number }}. Did the docs build complete?"}' https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments + fi