Skip to content

Commit b65161c

Browse files
Add separate workflow to build PRs from forks (#264)
1 parent d4e031d commit b65161c

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

.github/workflows/pr-build.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Build pull request
2+
on:
3+
pull_request:
4+
types:
5+
- opened
6+
- reopened
7+
- synchronize
8+
concurrency: build-${{ github.ref }}
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
# Run only on PRs from forks.
13+
if: ${{ github.event.pull_request.head.repo.fork }}
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 1
19+
submodules: true
20+
# Build the website
21+
- name: Use Node.js 20
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: 20
25+
cache: 'npm'
26+
- name: Build
27+
run: |
28+
npm ci
29+
npm run build

.github/workflows/pr-preview.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ concurrency: preview-${{ github.ref }}
1010
jobs:
1111
pr-preview:
1212
runs-on: ubuntu-latest
13+
# Do not run on PRs from forks, since they don't have the permissions to deploy to our GitHub pages branch.
14+
if: ${{ !github.event.pull_request.head.repo.fork }}
1315
steps:
1416
- name: Create app token
1517
uses: actions/create-github-app-token@v1

0 commit comments

Comments
 (0)