#152 allow single branch and detect default branch
Merged 3 years ago by pbokoc. Opened 3 years ago by jibecfed.
fedora-docs/ jibecfed/docs-fp-o allow-main-branches  into  prod

file modified
+11 -6
@@ -127,18 +127,23 @@ 

  

          # 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)

          

Use default branch defined in "content" => this prepare future migration to "main" as a default, and "master" as an exception
Detect cases when branch is a string instead of a list (which is currently used to say: the default branch for this repository is "main")

rebased onto 333ff5ee37be5b20e686d232b9a28abc4547d083

3 years ago

rebased onto 6e8094c

3 years ago

Pull-Request has been merged by pbokoc

3 years ago
Metadata