-
Notifications
You must be signed in to change notification settings - Fork 593
63 lines (56 loc) · 2.18 KB
/
fern-docs-preview-build.yml
File metadata and controls
63 lines (56 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# SPDX-FileCopyrightText: Copyright (c) 2025-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 the fern/ sources and PR metadata from the (possibly untrusted) PR
# branch and uploads them as an artifact. No secrets are used here, so this is
# safe to run on fork PRs via the regular pull_request trigger.
#
# The companion workflow (fern-docs-preview-comment.yml) picks up the artifact,
# builds the preview with DOCS_FERN_TOKEN, and posts the PR comment.
name: "Preview Fern Docs: Build"
on:
pull_request:
paths:
- 'fern/**'
- '.github/workflows/fern-docs-preview-build.yml'
permissions:
contents: read
jobs:
collect:
runs-on: ubuntu-latest
steps:
- name: Checkout PR
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Save PR metadata
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
HEAD_REF: ${{ github.head_ref }}
BASE_REF: ${{ github.base_ref }}
run: |
mkdir -p .preview-metadata
echo "$PR_NUMBER" > .preview-metadata/pr_number
echo "$HEAD_REF" > .preview-metadata/head_ref
git diff --name-only "origin/${BASE_REF}...HEAD" -- '*.mdx' > .preview-metadata/changed_mdx_files 2>/dev/null || true
- name: Upload fern sources and metadata
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: fern-preview
path: |
fern/
.preview-metadata/
retention-days: 1