From 80887192777acdd4b76acc13e605826a1afc10fd Mon Sep 17 00:00:00 2001 From: Brian Kroth Date: Wed, 13 Nov 2024 17:23:29 +0000 Subject: [PATCH] fixup for keeping files based on github actions --- Makefile | 2 +- doc/source/conf.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index eec7baa3061..d465b2b70ea 100644 --- a/Makefile +++ b/Makefile @@ -668,7 +668,7 @@ endif # Treat warnings as failures. SPHINXOPTS ?= # -v # be verbose -SPHINXOPTS += -n -W -w $(PWD)/doc/build/sphinx-build.warn.log -j auto +SPHINXOPTS += -n -W -w $(CURDIR)/doc/build/sphinx-build.warn.log -j auto sphinx-apidoc: doc/build/html/index.html diff --git a/doc/source/conf.py b/doc/source/conf.py index db266c18f49..b9043e9214f 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -123,6 +123,13 @@ def linkcode_resolve(domain: str, info: Dict[str, str]): return f"https://github.com/microsoft/MLOS/tree/main/{path}" +def is_on_github_actions(): + """Check if the documentation is being built on GitHub Actions.""" + if "CI" not in os.environ or not os.environ["CI"] or "GITHUB_RUN_ID" not in os.environ: + return False + return True + + # Add mappings to link to external documentation. intersphinx_mapping = get_intersphinx_mapping( packages={ @@ -242,7 +249,7 @@ def linkcode_resolve(domain: str, info: Dict[str, str]): autoapi_python_class_content = "both" autoapi_member_order = "groupwise" autoapi_add_toctree_entry = False # handled manually -# autoapi_keep_files = True # for testing +autoapi_keep_files = not is_on_github_actions() # for local testing # -- Options for HTML output -------------------------------------------------