Skip to content

Merge branch 'main' into fix/direct-dep-features #864

Merge branch 'main' into fix/direct-dep-features

Merge branch 'main' into fix/direct-dep-features #864

# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Workflow 1 of 2 for Fern doc previews.
#
# Collects fern/, docs/, and PR metadata and uploads an artifact.
#
# The companion workflow (fern-docs-preview-comment.yml) runs after this one;
# it skips cleanly when no artifact exists (e.g. skipped fork pull_request).
name: "Preview Fern Docs: Build"
on:
pull_request:
paths:
- 'fern/**'
- 'docs/**'
- '.github/workflows/fern-docs-preview-build.yml'
push:
branches:
- 'pull-request/[0-9]+'
paths:
- 'fern/**'
- 'docs/**'
- '.github/workflows/fern-docs-preview-build.yml'
permissions:
contents: read
jobs:
collect:
if: >-
(github.event_name == 'push' && contains(github.ref, 'refs/heads/pull-request/'))
|| (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
runs-on: ubuntu-latest
steps:
- name: Checkout PR
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Save PR metadata
env:
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
run: |
mkdir -p preview-metadata
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "${{ github.event.pull_request.number }}" > preview-metadata/pr_number
echo "${{ github.head_ref }}" > preview-metadata/head_ref
git diff --name-only "origin/${{ github.base_ref }}...HEAD" -- '*.md' > preview-metadata/changed_md_files 2>/dev/null || true
else
# copy-pr-bot push to pull-request/<n> (no pull_request payload on push)
branch="${GITHUB_REF_NAME}"
echo "${branch#pull-request/}" > preview-metadata/pr_number
echo "${branch}" > preview-metadata/head_ref
git fetch origin "${DEFAULT_BRANCH}" --depth=64 2>/dev/null || true
git diff --name-only "origin/${DEFAULT_BRANCH}...HEAD" -- '*.md' > preview-metadata/changed_md_files 2>/dev/null || true
fi
- name: Upload Fern docs inputs and metadata
uses: actions/upload-artifact@v4
with:
name: fern-preview
path: |
fern/
docs/
preview-metadata/
retention-days: 1