[#30] Allow generating valid autodoc outside of git
Description
Problem: sometimes we can't expect git environment to be available at build time (example: nix in CI), thus our attempt to take git commit for autodoc fails and we get invalid reference to code revision.
Solution: allow providing custom commit sha and date.
Now, if git env is not available, one can provide the following variables to fill code revision info in generated documentation correctly:
-
GIT_COMMIT_SHA
- full commit sha, what is usually returned bygit rev-parse HEAD
. -
GIT_COMMiT_DATE
- commit date, what is usually returned bygit log HEAD -1 --format=%cd
.
Note, that these env variables have to be provided at build time, not
execution time. As an advantage, we do not call git
at all if those
environmental variables are provided.
I picked quite common names in hope that if they are defined (e.g. by CI), then their values are set to what we expect from them.
Related issue(s)
Resolves #30 (closed).
✅ Checklist for your Merge Request
Related changes (conditional)
-
Tests (see short guidelines)
-
If I added new functionality, I added tests covering it. -
If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
-
-
Documentation
Stylistic guide (mandatory)
-
My commits comply with the following policy. -
My code complies with the style guide.