-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
31bedf9
commit 3559b6b
Showing
3 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: ci | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
preview-docs: | ||
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: Generate Documentation Preview with Fern | ||
id: generate_docs | ||
env: | ||
FERN_TOKEN: ${{ secrets.FERN_TOKEN }} | ||
run: | | ||
output=$(fern generate --docs --preview) | ||
echo "$output" | ||
# Extract the URL and append it to GITHUB_ENV | ||
echo "preview_url=$(echo "$output" | grep -oP '(?<=Published docs to )https://[^\s]*')" >> $GITHUB_ENV | ||
- name: Comment PR with URL using github-actions bot | ||
uses: actions/github-script@v4 | ||
if: ${{ steps.generate_docs.outputs.preview_url }} | ||
with: | ||
script: | | ||
const preview_url = '${{ env.preview_url }}'; | ||
const issue_number = context.issue.number; | ||
github.issues.createComment({ | ||
...context.repo, | ||
issue_number: issue_number, | ||
body: `Published docs preview URL: ${preview_url}` | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"organization": "YourOrganization", | ||
"organization": "your-organization", | ||
"version": "0.15.0-rc50" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{} | ||
{} |