mhausenblas / mkdocs-deploy-gh-pages

GitHub Action to deploy an MkDocs site to GitHub Pages
Apache License 2.0
251 stars 91 forks source link

question about requirements.txt #53

Open epogrebnyak opened 4 years ago

epogrebnyak commented 4 years ago

I have requirements.txt for my python package, but not related to documentation, the docs just depend on mkdocs and that is it. Why does Actions need to rely on requirements.txt to build docs? (I currently have a fault in numpy installation that blocks building the docs). When I rename requirements the Action passes fine.

https://github.com/mhausenblas/mkdocs-deploy-gh-pages/blob/3aac6d643ddf02203957d5a25c6b54c710e4f72e/action.sh#L9-L16

frinzekt commented 3 years ago

Hi @epogrebnyak , the reason why this action may or may not need the requirements.txt file is because for custom mkdocs it may sometimes need a requirements.txt.

Eg. when including mermaid markdown

# Contents of requirements.txt
mkdocs-material
mkdocs-mermaid2-plugin

However, you do have an excellent point that some mkdoc repository especially for the basic one will not need a requirements.txt file. In terms of how to make it better for this repository, I am not quite sure, but in my humble opinion, I think changing the code to

 if  [ -f "${GITHUB_WORKSPACE}/${REQUIREMENTS}" ]; then 
     pip install -r "${GITHUB_WORKSPACE}/${REQUIREMENTS}" 
 fi 

I am not that familiar with shell scripting, so pardon me if there is a mistake here, but my idea is that to install requirements.txt the environment variable REQUIREMENTS has to be present and points to a valid requirements.txt file. What do you think @mhausenblas ?

mhausenblas commented 3 years ago

Sounds good, wanna PR it?

frinzekt commented 3 years ago

sure

rekire commented 3 years ago

This should be part of the README.md