Skip to content

New Crowdin updates #3017

New Crowdin updates

New Crowdin updates #3017

Workflow file for this run

name: PR Preview
on:
pull_request_target:
types:
- opened
- reopened
- synchronize
- closed
concurrency:
group: pr-preview-${{ github.event.number }}
cancel-in-progress: true
jobs:
lint:
if: ${{ github.event.action != 'closed' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: npm
- name: Install dependencies
run: npm ci
- name: Run formatter autofix
run: npm run format
- name: Run linter
run: npm run lint -- --frail
- name: Check for lint changes
id: lint_changes
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "has_changes=true" >> "$GITHUB_OUTPUT"
else
echo "has_changes=false" >> "$GITHUB_OUTPUT"
fi
- name: Fail when formatting is required
if: steps.lint_changes.outputs.has_changes == 'true'
run: |
echo "::error::Formatting or lint fixes were generated. Please run 'npm run format' followed by 'npm run lint' locally and push the resulting changes."
exit 1
deploy-preview:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v5
if: ${{ github.event.action != 'closed' }}
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.sha }}
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v6
if: ${{ github.event.action != 'closed' }}
with:
node-version-file: '.nvmrc'
cache: npm
- name: Install dependencies
if: ${{ github.event.action != 'closed' }}
run: npm ci
- name: Build documentation
if: ${{ github.event.action != 'closed' }}
run: npm run build
env:
BASE_URL: /docs/pr-preview/pr-${{ github.event.number }}/
GITHUB_BRANCH: ${{ github.event.pull_request.head.ref }}
- name: Ensure build directory exists for cleanup
if: ${{ github.event.action == 'closed' }}
run: mkdir -p build
- name: Deploy PR Preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./build/
preview-branch: gh-pages
umbrella-dir: pr-preview
action: auto