fralau / mkdocs-macros-plugin

Create richer and more beautiful pages in MkDocs, by using variables and calls to macros in the markdown code.
https://mkdocs-macros-plugin.readthedocs.io
Other
321 stars 50 forks source link

How to access a env variable? #142

Closed xrow closed 1 year ago

xrow commented 2 years ago

{{ git.tag }} was not working for me inside a gitlab pipeline but outside...

My idea was to access a env var instead, but I did not know how. I read a couple of sources on the internet but nothing worked for me. Maybe you can include a howto in the docs.

github-actions[bot] commented 2 years ago

Welcome to this project and thank you!' first issue

xrow commented 2 years ago

I made it work like...

extra:
  scm:
    latest: !ENV [CI_LATEST_TAG, '3.0.1']

{{ scm.latest }}

I think it sould be easier.

fralau commented 2 years ago

Well done for the workaround.

mkdocs-macros converts git.tag into git describe --tags.

What error message do you get? What would you get, if you ran the command from the shell?

xrow commented 2 years ago

I get no error just in empty string.

fralau commented 2 years ago

Also from the shell?

xrow commented 2 years ago

There is no warning or else in the cli just the confirmation that is is loading

DEBUG - [macros] - Variables: ['extra', 'config', 'environment', 'plugin', 'git', 'generator', 'social', 'consent']

xrow commented 2 years ago

Acutally for the git.tag thing I opened also https://github.com/fralau/mkdocs_macros_plugin/issues/143

fralau commented 2 years ago

What is the situation of this issue?