Skip to content

[#30] Allow generating valid autodoc outside of git

Konstantin Ivanov requested to merge martoon/#30-no-git-in-autodoc into master

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 by git rev-parse HEAD.
  • GIT_COMMiT_DATE - commit date, what is usually returned by git 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

    • I checked whether I should update the docs and did so if necessary:

Stylistic guide (mandatory)

Edited by Konstantin Ivanov

Merge request reports