Skip to content

New Crowdin updates #140

New Crowdin updates

New Crowdin updates #140

name: Fork Preview Build
on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
paths:
- docs/**
- i18n/**
- src/**
- static/**
- scripts/**
- package.json
- pnpm-lock.yaml
- tsconfig.json
- babel.config.js
- docusaurus.config.ts
- sidebars.js
- sidebar-semver-sort.js
- .github/workflows/fork-preview-build.yml
- .github/workflows/fork-preview-deploy.yml
permissions:
contents: read
concurrency:
group: fork-preview-build-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
build:
if: github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
steps:
- name: Checkout PR head
uses: actions/checkout@v6
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup pnpm
uses: pnpm/action-setup@v6
with:
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: .nvmrc
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install dependencies
run: pnpm install --frozen-lockfile --prefer-offline
- name: Build site
run: pnpm build
- name: Write preview metadata
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
HEAD_REF: ${{ github.event.pull_request.head.ref }}
HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
BASE_REPO: ${{ github.repository }}
run: |
set -euo pipefail
mkdir -p .preview-artifact
jq -n \
--argjson pr_number "${PR_NUMBER}" \
--arg head_sha "${HEAD_SHA}" \
--arg head_ref "${HEAD_REF}" \
--arg head_repo "${HEAD_REPO}" \
--arg base_repo "${BASE_REPO}" \
'{
pr_number: $pr_number,
head_sha: $head_sha,
head_ref: $head_ref,
head_repo: $head_repo,
base_repo: $base_repo
}' > .preview-artifact/metadata.json
- name: Upload preview artifact
uses: actions/upload-artifact@v7
with:
name: pr-preview-site
path: |
build
.preview-artifact/metadata.json
if-no-files-found: error
retention-days: 7