Skip to content

mkdocs build fails during GitHub Actions run, but works fine locally through Git Bash. What are possible causes? #3687

Closed Answered by pawamoy
Andre601 asked this question in Q&A
Discussion options

You must be logged in to vote

OK, got it. Previously, MkDocs didn't touch to sys.path before and after executing a hook module. So when you inserted a path, this path stayed there for the whole run. Now, with MkDocs 1.6, any modification to sys.path in a hook module is reverted after the hook module was executed.

Since the functions defined in your hook are indeed executed after MkDocs has reverted sys.path to not contain the .hooks folder, by the time the package loader tries to find the theme module, its parent folder is not in sys.path anymore and the loader fails to find it.

Workaround: move the sys.path modification into the on_page_markdown function.

Replies: 2 comments 9 replies

Comment options

pawamoy
Apr 26, 2024
Maintainer Sponsor

You must be logged in to vote
7 replies
@Andre601
Comment options

@pawamoy
Comment options

pawamoy Apr 26, 2024
Maintainer Sponsor

@Andre601
Comment options

@pawamoy
Comment options

pawamoy Apr 26, 2024
Maintainer Sponsor

@Andre601
Comment options

Comment options

pawamoy
Apr 26, 2024
Maintainer Sponsor

You must be logged in to vote
2 replies
@Andre601
Comment options

@Andre601
Comment options

Answer selected by Andre601
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants