diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 888898e0..712e4e75 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -6,6 +6,7 @@ on: branches: [ "main" ] pull_request: branches: [ "main" ] + types: [ "opened", "reopened", "synchronize", "closed" ] merge_group: jobs: @@ -37,8 +38,8 @@ jobs: path: docs/.vitepress/dist deploy: - if: github.ref_name == github.event.repository.default_branch runs-on: ubuntu-24.04 + if: github.ref_name == github.event.repository.default_branch needs: [ build ] permissions: pages: write @@ -50,3 +51,21 @@ jobs: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4 + + preview: + runs-on: ubuntu-24.04 + if: github.ref_name != github.event.repository.default_branch + needs: [ build ] + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - uses: rossjrw/pr-preview-action@v1 + if: github.ref_name != github.event.repository.default_branch + with: + source-dir: build + preview-branch: main + umbrella-dir: docs/pr-preview