From e671b095b49ad33fd39a9dfa0f85f49fd0de3b99 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Wed, 20 Nov 2024 16:28:38 +0100 Subject: [PATCH 1/6] Build page preview on all PRs --- .github/workflows/gh-page-preview.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/gh-page-preview.yml b/.github/workflows/gh-page-preview.yml index 11566e1b6..fd6ad66b9 100644 --- a/.github/workflows/gh-page-preview.yml +++ b/.github/workflows/gh-page-preview.yml @@ -3,8 +3,6 @@ name: PR Preview on: pull_request: types: [opened, synchronize, reopened] - paths: - - 'website/**' jobs: build-and-deploy: @@ -72,4 +70,4 @@ jobs: run: | git rm -rf __preview/pr-${{ github.event.pull_request.number }} git commit -m "Remove preview for PR #${{ github.event.pull_request.number }}" - git push origin gh-pages \ No newline at end of file + git push origin gh-pages From 72d00324ada53dee435f90af5bd92c76fab7ced1 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Wed, 20 Nov 2024 10:40:09 -0500 Subject: [PATCH 2/6] Fix checkout? --- .github/workflows/gh-page-preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gh-page-preview.yml b/.github/workflows/gh-page-preview.yml index fd6ad66b9..c92a25682 100644 --- a/.github/workflows/gh-page-preview.yml +++ b/.github/workflows/gh-page-preview.yml @@ -12,7 +12,7 @@ jobs: - name: Checkout PR Branch uses: actions/checkout@v4 with: - ref: ${{ github.head_ref }} + fetch-depth: 1 - name: Set up Python uses: actions/setup-python@v5 From f215327f83a50b8b07d73d93a6a7730a433bb4c8 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Wed, 20 Nov 2024 10:48:57 -0500 Subject: [PATCH 3/6] Update gh-pages action --- .github/workflows/gh-page-preview.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/gh-page-preview.yml b/.github/workflows/gh-page-preview.yml index c92a25682..170a21e03 100644 --- a/.github/workflows/gh-page-preview.yml +++ b/.github/workflows/gh-page-preview.yml @@ -40,11 +40,10 @@ jobs: working-directory: ./website - name: Deploy to Publication Branch - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./website/.output/public - publish_branch: gh-pages destination_dir: __preview/pr-${{ github.event.pull_request.number }} - name: Create or Update PR Comment with Preview Link From 545495bafd9e7c33b34f90a45c92e410960f74a3 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Wed, 20 Nov 2024 11:20:14 -0500 Subject: [PATCH 4/6] Test using PAT -- GITHUB_SECRET doesn't have write from fork. --- .github/workflows/gh-page-preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gh-page-preview.yml b/.github/workflows/gh-page-preview.yml index 170a21e03..04ca07481 100644 --- a/.github/workflows/gh-page-preview.yml +++ b/.github/workflows/gh-page-preview.yml @@ -42,7 +42,7 @@ jobs: - name: Deploy to Publication Branch uses: peaceiris/actions-gh-pages@v4 with: - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.PAT }} publish_dir: ./website/.output/public destination_dir: __preview/pr-${{ github.event.pull_request.number }} From a49961fa3f632dd6f624aa66de25904027e8393e Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Wed, 20 Nov 2024 12:33:58 -0500 Subject: [PATCH 5/6] Fix action credential arg to personal_token --- .github/workflows/gh-page-preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gh-page-preview.yml b/.github/workflows/gh-page-preview.yml index 04ca07481..b370031b0 100644 --- a/.github/workflows/gh-page-preview.yml +++ b/.github/workflows/gh-page-preview.yml @@ -42,7 +42,7 @@ jobs: - name: Deploy to Publication Branch uses: peaceiris/actions-gh-pages@v4 with: - github_token: ${{ secrets.PAT }} + personal_token: ${{ secrets.PAT }} publish_dir: ./website/.output/public destination_dir: __preview/pr-${{ github.event.pull_request.number }} From 5597324f5d2e932d5ceb4c8df733f09cf4015def Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Wed, 20 Nov 2024 12:57:44 -0500 Subject: [PATCH 6/6] Test context of target --- .github/workflows/gh-page-preview.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gh-page-preview.yml b/.github/workflows/gh-page-preview.yml index b370031b0..2e5af0d0b 100644 --- a/.github/workflows/gh-page-preview.yml +++ b/.github/workflows/gh-page-preview.yml @@ -1,7 +1,7 @@ name: PR Preview on: - pull_request: + pull_request_target: types: [opened, synchronize, reopened] jobs: @@ -42,7 +42,7 @@ jobs: - name: Deploy to Publication Branch uses: peaceiris/actions-gh-pages@v4 with: - personal_token: ${{ secrets.PAT }} + github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./website/.output/public destination_dir: __preview/pr-${{ github.event.pull_request.number }}