Skip to content

Commit

Permalink
Merge pull request #19 from bigladder/update-readme
Browse files Browse the repository at this point in the history
Fix for creating web docs in detached HEAD state
  • Loading branch information
nealkruis authored Dec 1, 2022
2 parents f22a07e + ba098f3 commit 96fbb55
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/build-web.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Web Documentation

on: push
on:
release:
types:
- created

jobs:
build:
Expand Down
7 changes: 5 additions & 2 deletions lattice/docs/hugo_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ def get_git_info(self):
self.git_repo_name = git_url_parts[-1]
self.git_repo_owner = git_url_parts[-2]
self.git_repo_host = os.path.splitext(git_url_parts[-3])[0]
self.git_branch_name = self.git_repo.active_branch.name
if self.git_repo.head.is_detached:
self.git_ref_name = "main"
else:
self.git_ref_name = self.git_repo.head.ref.name
self.base_url = fr"https://{self.git_repo_owner}.{self.git_repo_host}.io/{self.git_repo_name}/"

def make_pages(self):
Expand Down Expand Up @@ -285,7 +288,7 @@ def make_hugo_config(self):
"params": {
"copyright": self.author,
"github_repo": self.git_remote_url,
"github_branch": self.git_branch_name,
"github_branch": self.git_ref_name,
"ui": {
"navbar_logo": self.has_logo,
"breadcrumb_disable": True
Expand Down

0 comments on commit 96fbb55

Please sign in to comment.