Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docs): single preview comment #5302

Merged
merged 7 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions .github/workflows/preview-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,24 @@ jobs:
echo "Preview URL: $URL"
echo "🌿 Preview your docs: $URL" > preview_url.txt

- name: Comment URL in PR
uses: thollander/actions-comment-pull-request@v2.4.3
with:
filePath: preview_url.txt
comment_tag: docs-preview-link
- name: Comment or Update URL in PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
COMMENT_TAG="<!-- docs-preview-link -->"
PREVIEW_URL=$(cat preview_url.txt)

# Get existing comments
EXISTING_COMMENT=$(gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
--jq ".[] | select(.body | contains(\"${COMMENT_TAG}\")) | .id")

if [ -z "$EXISTING_COMMENT" ]; then
# No existing comment, create one
gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
-f body="${COMMENT_TAG}\n🌿 Preview your docs: $PREVIEW_URL"
else
# Update existing comment
gh api repos/${{ github.repository }}/issues/comments/$EXISTING_COMMENT \
-X PATCH \
-f body="${COMMENT_TAG}\n🌿 Preview your docs: $PREVIEW_URL"
fi
2 changes: 2 additions & 0 deletions fern/pages/docs/building-your-docs/announcement-banner.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ announcement:
```

Markdown and HTML is supported in the announcement message. You can include links, images, and other formatting. [Custom css](/learn/docs/building-your-docs/custom-css-global-js#custom-css) can be used to customize the style of the announcement.

Another docs change
Loading