diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index 91059032..b052f1f4 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -16,7 +16,8 @@ jobs: - name: Checkout PR branch uses: actions/checkout@v4 with: - ref: ${{ github.event.pull_request.head.sha }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.event.pull_request.head.ref }} fetch-depth: 1 - name: Set up Node.js @@ -27,9 +28,7 @@ jobs: - name: Copy files to preview folder run: | mkdir -p preview/pr-${{ github.event.pull_request.number }} - cp -r * preview/pr-${{ github.event.pull_request.number }}/ - rm -rf preview/pr-${{ github.event.pull_request.number }}/.git - rm -rf preview/pr-${{ github.event.pull_request.number }}/.github + rsync -av --exclude 'preview' --exclude '.git' --exclude '.github' ./ preview/pr-${{ github.event.pull_request.number }}/ - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v4 @@ -46,4 +45,4 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} header: preview-url message: | - 🚀 PR Preview: PR Preview: https://opensource-society.github.io/${{ github.repository }}/pr-preview/pr-${{ github.event.pull_request.number }}/index.html + 🚀 PR Preview: PR Preview: https://opensource-society.github.io/${{ github.repository }}/pr-preview/pr-${{ github.event.pull_request.number }}/index.html