Skip to content

Commit

Permalink
Update preview-docs.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
edmcquinn authored Mar 18, 2024
1 parent 107467e commit 2fbb6a2
Showing 1 changed file with 8 additions and 30 deletions.
38 changes: 8 additions & 30 deletions .github/workflows/preview-docs.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,30 @@
name: fern
name: preview-docs

on: pull_request

jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18"

- name: Install Fern
run: npm install -g fern-api

- name: Validate API configuration
run: fern check

preview-docs:
needs: check
run:
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18"

- name: Install Fern
run: npm install -g fern-api

- name: Generate preview URL
id: generate-docs
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: |
OUTPUT="$(fern generate --docs --preview)"
echo "Command Output: $OUTPUT"
OUTPUT=$(fern generate --docs --preview 2>&1) || true
echo "$OUTPUT"
URL=$(echo "$OUTPUT" | grep -oP 'Published docs to \K.*(?= \()')
echo "Preview your docs: $URL" > preview_url.txt
echo "Preview URL: $URL"
echo "🌿 Preview your docs: $URL" > preview_url.txt
- name: Comment URL in PR
uses: thollander/[email protected]
with:
filePath: preview_url.txt
filePath: preview_url.txt

0 comments on commit 2fbb6a2

Please sign in to comment.