diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8a05a0..229807f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,11 +68,11 @@ jobs: run: poetry run pytest - name: Create MkDocs Project run: | - juvix-mkdocs new -f -n --no-run-server --no-open --project-name - my-juvix-project --anoma-setup + juvix-mkdocs new -f -n -D --no-run-server --no-open --project-name my-juvix-project --anoma-setup - name: Build MkDocs Project run: juvix-mkdocs build -p my-juvix-project env: + NO_INTERACTION: true SITE_URL: https://anoma.github.io/juvix-mkdocs SITE_NAME: Juvix MkDocs - if: success() diff --git a/mkdocs_juvix/main.py b/mkdocs_juvix/main.py index 671a31a..ae1dd1e 100644 --- a/mkdocs_juvix/main.py +++ b/mkdocs_juvix/main.py @@ -1,5 +1,6 @@ import asyncio import json +import os import shutil import subprocess import textwrap @@ -1556,11 +1557,8 @@ class JuvixPlugin(BasePlugin): wikilinks_plugin: WikilinksPlugin first_run: bool = True response: Optional[str] = None - use_juvix_question = questionary.select( - "Do you want to process Juvix Markdown files (this will take longer)?", - choices=["yes", "no", "always", "never"], - default="no", - ) + use_juvix_question: Optional[questionary.Question] = None + def on_startup(self, *, command: str, dirty: bool) -> None: clear_screen() @@ -1571,14 +1569,17 @@ def on_config(self, config: MkDocsConfig) -> MkDocsConfig: self.env.SITE_DIR = config.get("site_dir", getenv("SITE_DIR", None)) - # ask the user if they want to process Juvix Markdown files, options, - # yes no, always, never - if self.response in ["yes", "no"] or self.response is None: + if not os.environ.get("CI") or os.getenv("NO_INTERACTION"): + self.use_juvix_question = questionary.select( + "Do you want to process Juvix Markdown files (this will take longer)?", + choices=["yes", "no", "always", "never"], + default="no", + ) self.response = self.use_juvix_question.ask() - if self.response == "never": - self.env.JUVIX_ENABLED = False - elif self.response == "always": - self.env.JUVIX_ENABLED = True + if self.response == "never": + self.env.JUVIX_ENABLED = False + elif self.response == "always": + self.env.JUVIX_ENABLED = True if self.env.JUVIX_ENABLED and not self.env.JUVIX_AVAILABLE: log.error(