Skip to content

Commit

Permalink
Address doc generation not finding git repo in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
victorreijgwart committed Aug 16, 2024
1 parent 83a94fc commit cf332c7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ jobs:
apt-get update
apt-get install -q -y --no-install-recommends python3-pip doxygen
apt-get install -q -y --no-install-recommends latexmk texlive-latex-extra tex-gyre texlive-fonts-recommended texlive-latex-recommended
pip3 install exhale sphinx-sitemap sphinx-design gitpython
pip3 install exhale sphinx-sitemap sphinx-design
pip3 install sphinxawesome-theme --pre
pip3 install "sphinx<7,>6"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ jobs:
apt-get update
apt-get install -q -y --no-install-recommends python3-pip doxygen
apt-get install -q -y --no-install-recommends latexmk texlive-latex-extra tex-gyre texlive-fonts-recommended texlive-latex-recommended
pip3 install exhale sphinx-sitemap sphinx-design gitpython
pip3 install exhale sphinx-sitemap sphinx-design
pip3 install sphinxawesome-theme --pre
pip3 install "sphinx<7,>6"
Expand Down
11 changes: 8 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import os
from sys import argv
from dataclasses import asdict
from sphinxawesome_theme import ThemeOptions
from sphinxawesome_theme.postprocess import Icons
import lxml.etree
import git

# Project information
project = 'wavemap'
Expand Down Expand Up @@ -127,8 +127,13 @@
highlight_language = 'cpp'

# Provide a short syntax to link to files in the repository
repo = git.Repo(search_parent_directories=True)
sha = repo.head.object.hexsha
sha = os.environ.get('GITHUB_SHA') # Attempt to read it from CI env variables
if sha is None:
import git

repo = git.Repo(os.path.dirname(__file__), search_parent_directories=True)
sha = repo.head.object.hexsha

extlinks = {
"gh_file": (f"https://github.com/ethz-asl/wavemap/tree/{sha}/%s", "%s"),
}
Expand Down

0 comments on commit cf332c7

Please sign in to comment.