Skip to content

Commit

Permalink
conf.py: Gate rtds_action
Browse files Browse the repository at this point in the history
Also add a proto warning announcement if it looks like a PR preview (since it won't have any generated content).
  • Loading branch information
KrystalDelusion committed Jul 18, 2024
1 parent eda61c3 commit 1ebde8f
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,30 @@
pygments_style = 'colorful'
highlight_language = 'none'

extensions = ['sphinx.ext.autosectionlabel', 'sphinxcontrib.bibtex', 'rtds_action']

# The name of your GitHub repository
rtds_action_github_repo = "KrystalDelusion/yosys"

# The path where the artifact should be extracted
# Note: this is relative to the conf.py file!
rtds_action_path = "."

# The "prefix" used in the `upload-artifact` step of the action
rtds_action_artifact_prefix = "cmd-ref-"

# A GitHub personal access token is required, more info below
rtds_action_github_token = os.environ["GITHUB_TOKEN"]
extensions = ['sphinx.ext.autosectionlabel', 'sphinxcontrib.bibtex']

if os.getenv("READTHEDOCS"):
# Use rtds_action if we are building on read the docs and have a github token env var
if os.getenv["GITHUB_TOKEN"]:
extensions += ['rtds_action']

# The name of your GitHub repository
rtds_action_github_repo = "KrystalDelusion/yosys"

# The path where the artifact should be extracted
# Note: this is relative to the conf.py file!
rtds_action_path = "."

# The "prefix" used in the `upload-artifact` step of the action
rtds_action_artifact_prefix = "cmd-ref-"

# A GitHub personal access token is required for full RTD builds
rtds_action_github_token = os.environ["GITHUB_TOKEN"]
else:
# We're on read the docs but have no github token, this is probably a PR preview build
html_theme_options["announcement"] = "<strong>Oh no!</strong> This looks like a ReadTheDocs build, possibly for a PR preview, that's missing some generated content!"
html_theme_options["light_css_variables"]["color-announcement-background"] = "var(--color-admonition-title-background--caution)"
html_theme_options["light_css_variables"]["color-announcement-text"] = "var(--color-content-foreground)"

# Ensure that autosectionlabel will produce unique names
autosectionlabel_prefix_document = True
Expand Down

0 comments on commit 1ebde8f

Please sign in to comment.