From 42ccda423ee60ff6d9d1c43f0d5fa50c11495a47 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Wed, 9 Apr 2025 14:35:16 +0200 Subject: [PATCH 1/3] Don't try to deploy previews for PRs from forks --- .github/workflows/pr-preview.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index f96098aa6cd2..77b956aaa385 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -10,6 +10,8 @@ concurrency: preview-${{ github.ref }} jobs: pr-preview: runs-on: ubuntu-latest + # Do not run on PRs from forks, since they don't have the permissions to deploy to our GitHub pages branch. + if: ${{ !github.event.pull_request.head.repo.fork }} steps: - name: Create app token uses: actions/create-github-app-token@v1 From 119831aa81071545ece209a7ece0aa0ead090f8f Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Wed, 9 Apr 2025 14:37:39 +0200 Subject: [PATCH 2/3] Add workflow to build PRs from forks --- .github/workflows/pr-build.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/pr-build.yml diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml new file mode 100644 index 000000000000..dfa59bdba716 --- /dev/null +++ b/.github/workflows/pr-build.yml @@ -0,0 +1,29 @@ +name: Build pull request +on: + pull_request: + types: + - opened + - reopened + - synchronize +concurrency: build-${{ github.ref }} +jobs: + pr-preview: + runs-on: ubuntu-latest + # Run only on PRs from forks. + if: ${{ github.event.pull_request.head.repo.fork }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 1 + submodules: true + # Build the website + - name: Use Node.js 20 + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + - name: Build + run: | + npm ci + npm run build From 1a7a1d7b02c8201e4e5d67f75e4dbc40a4c8de51 Mon Sep 17 00:00:00 2001 From: Mattias Buelens Date: Wed, 9 Apr 2025 14:44:04 +0200 Subject: [PATCH 3/3] Rename job --- .github/workflows/pr-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index dfa59bdba716..0bb068567d8c 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -7,7 +7,7 @@ on: - synchronize concurrency: build-${{ github.ref }} jobs: - pr-preview: + build: runs-on: ubuntu-latest # Run only on PRs from forks. if: ${{ github.event.pull_request.head.repo.fork }}