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

Add announcement for pull request previews #12

Merged
merged 2 commits into from
Mar 11, 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
3 changes: 3 additions & 0 deletions .github/workflows/pr-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ jobs:
DOCUSAURUS_BASE_URL: /${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.number }}/
# Prevent PR previews from being indexed by search engines
DOCUSAURUS_NO_INDEX: 1
# Add an announcement at the top to indicate that this is a preview
DOCUSAURUS_PR_NUMBER: ${{ github.event.number }}
DOCUSAURUS_PR_URL: ${{ github.event.pull_request.html_url }}
# Deploy preview
- name: Deploy preview
uses: rossjrw/pr-preview-action@v1
Expand Down
9 changes: 9 additions & 0 deletions docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@ const config: Config = {
themeConfig: {
// TODO Replace with your project's social card
// image: 'img/docusaurus-social-card.jpg',
announcementBar: process.env.DOCUSAURUS_PR_NUMBER
? {
id: 'pr_preview',
content: `This is a preview of the documentation website from <a target="_blank" rel="noopener noreferrer" href="${process.env.DOCUSAURUS_PR_URL}">pull request #${process.env.DOCUSAURUS_PR_NUMBER}</a>.`,
backgroundColor: '#9cb9c9',
textColor: '#344a5e',
isCloseable: false,
}
: undefined,
navbar: {
title: 'Docs',
logo: {
Expand Down