diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index c5858ca..0fe5c6f 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -23,6 +23,7 @@ jobs: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} permissions: contents: write + pages: write steps: - uses: actions/checkout@v4 @@ -41,6 +42,16 @@ jobs: run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) shell: Rscript {0} + - name: Enable GitHub Pages + if: github.event_name != 'pull_request' + run: | + gh api repos/${{ github.repository }}/pages \ + --method POST --input - <<'EOF' || true + {"source":{"branch":"gh-pages","path":"/"}} + EOF + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Deploy to GitHub pages if: github.event_name != 'pull_request' uses: JamesIves/github-pages-deploy-action@v4.7.3