From 2fb30e98e281321057006b3f5fd47eae2ba576f0 Mon Sep 17 00:00:00 2001 From: Hannah Lanzrath Date: Fri, 30 Jan 2026 16:15:10 +0100 Subject: [PATCH] fix: Allow deprecated header name when extracting output repo branch --- cadetrdm/repositories.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cadetrdm/repositories.py b/cadetrdm/repositories.py index 0d4220a..1d97e88 100644 --- a/cadetrdm/repositories.py +++ b/cadetrdm/repositories.py @@ -1768,20 +1768,29 @@ def _add_branch_name_to_log(self) -> None: """ Update the TSV file by adding a 'project_repo_branch' column. - The branch name is extracted from the 'output_repo_commit_message' field. + The branch name is extracted from the 'Output repo branch' field. """ self.checkout(self.main_branch) with open(self.output_log_file_path, "r") as f: reader = csv.DictReader(f, delimiter="\t") rows = list(reader) + + if not rows: + return + fieldnames = list(rows[0].keys()) + # support old/new header names + if "output_repo_branch" in rows[0]: + branch_col = "output_repo_branch" + elif "Output repo branch" in rows[0]: + branch_col = "Output repo branch" + # Add new column to header if not present if "project_repo_branch" not in rows[0]: for row in rows: - commit_msg = row["output_repo_branch"] - branch = commit_msg.split("_")[2] + branch = branch_colc.split("_")[2] row["project_repo_branch"] = branch if "project_repo_branch" not in fieldnames: