Add Preview workflow that works with forks (#138)

This commit is contained in:
Piotr Rogowski 2023-09-24 10:57:36 +02:00 committed by GitHub
parent 04a6a7f50d
commit 75d48d246a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 39 additions and 24 deletions

38
.github/workflows/build-preview.yml vendored Normal file
View File

@ -0,0 +1,38 @@
# Build preview to Cloudflare Pages
name: Build preview
concurrency:
group: ${{ github.ref }}-preview
cancel-in-progress: true
on:
pull_request:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
if: github.repository_owner == 'FOME-Tech' && github.actor != 'dependabot[bot]'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Install Node.js dependencies
run: npm ci
- name: Build
run: npm run build
- name: Save PR number
run: |
echo ${{ github.event.number }} > ./build/PR_NR
- name: Upload preview build
uses: actions/upload-artifact@v2
with:
name: build
path: build/

View File

@ -1,23 +0,0 @@
# Validate build to provide early feedback on pull requests
name: Build
concurrency:
group: ${{ github.ref }}-build
cancel-in-progress: true
on:
pull_request:
branches: [master]
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: "npm"
- run: npm ci
- run: npm run build

View File

@ -12,7 +12,7 @@
"lint:fix:unsafe": "biome check . --apply-unsafe .",
"lint:ts": "tsc",
"lint:links": "node scripts/linkValidator.js 'docs/**/*.md?(x)'",
"lint:md": "npx markdownlint-cli docs",
"lint:md": "npx -y markdownlint-cli docs",
"lint:biome": "biome check .",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",