From 6e8094c702d18d205c5756aecfd1f502204f03e3 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Dec 16 2020 12:46:24 +0000 Subject: allow single branch and detect default branch --- diff --git a/build-scripts/rebuild-site.py b/build-scripts/rebuild-site.py index a2f1202..7801898 100755 --- a/build-scripts/rebuild-site.py +++ b/build-scripts/rebuild-site.py @@ -127,18 +127,23 @@ def prepare_translated_sources(translated_sources, site_yml, languages, config): # Get a list of the original English repos repos = [] + default_branch = site_yml["content"].get("branches", ["master"]) + if type(default_branch) is str: + default_branch = [default_branch] + for repo_data in site_yml["content"]["sources"]: - if "branches" not in repo_data: - repo_data["branches"] = ["master"] - if "start_path" not in repo_data: - repo_data["start_path"] = "" + branches = repo_data.get("branches", default_branch) + if type(branches) is str: + branches = [branches] + + start_path = repo_data.get("start_path", "") - for branch in repo_data["branches"]: + for branch in branches: repo = {} repo["url"] = repo_data["url"] repo["branch"] = branch - repo["start_path"] = repo_data["start_path"] + repo["start_path"] = start_path repos.append(repo)