From a92fbdebb6a2d2bb8a6c39d1856e2ba8d4ea20f5 Mon Sep 17 00:00:00 2001 From: mashehu Date: Thu, 27 Nov 2025 15:35:35 +0100 Subject: [PATCH 1/3] don't overwrite the defaultBranch if already set in nextflow.config --- nf_core/pipelines/create/create.py | 5 +++-- nf_core/pipelines/sync.py | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/nf_core/pipelines/create/create.py b/nf_core/pipelines/create/create.py index bfc8a97efb..73885f2e21 100644 --- a/nf_core/pipelines/create/create.py +++ b/nf_core/pipelines/create/create.py @@ -94,8 +94,9 @@ def __init__( if self.config.outdir is None: self.config.outdir = str(Path.cwd()) - # Get the default branch name from the Git configuration - self.get_default_branch() + # Get the default branch name from the Git configuration if it was not parsed from nextflow.config previously + if self.default_branch == "master": + self.get_default_branch() self.jinja_params, self.skip_areas = self.obtain_jinja_params_dict( self.config.skip_features or [], str(self.config.outdir) diff --git a/nf_core/pipelines/sync.py b/nf_core/pipelines/sync.py index 7ce358cd07..3b5a9470f9 100644 --- a/nf_core/pipelines/sync.py +++ b/nf_core/pipelines/sync.py @@ -310,11 +310,17 @@ def make_template_pipeline(self): yaml.safe_dump(self.config_yml.model_dump(exclude_none=True), config_path) try: + try: + default_branch = self.wf_config.manifest.default_branch or "master" + except AttributeError: + default_branch = "master" + pipeline_create_obj = nf_core.pipelines.create.create.PipelineCreate( outdir=str(self.pipeline_dir), from_config_file=True, no_git=True, force=True, + default_branch=default_branch, ) pipeline_create_obj.init_pipeline() From 62a1d4274884fec08fe38487fd18ae2be570caf7 Mon Sep 17 00:00:00 2001 From: nf-core-bot Date: Thu, 27 Nov 2025 14:37:52 +0000 Subject: [PATCH 2/3] [automated] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dac1598d91..6b93768805 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - switch to uv and pyproject.toml ([#3925](https://github.com/nf-core/tools/pull/3925)) - Pin j178/prek-action action to 91fd7d7 ([#3931](https://github.com/nf-core/tools/pull/3931)) - add pre-commit hook to keep uv.lock in sync ([#3933](https://github.com/nf-core/tools/pull/3933)) +- sync: don't overwrite the defaultBranch if already set in nextflow.config ([#3939](https://github.com/nf-core/tools/pull/3939)) ### Template From b3d4ad333c4bd48f9574c46f96184ee1e0dfbfb9 Mon Sep 17 00:00:00 2001 From: mashehu Date: Thu, 27 Nov 2025 15:49:49 +0100 Subject: [PATCH 3/3] set type hints --- nf_core/pipelines/sync.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/nf_core/pipelines/sync.py b/nf_core/pipelines/sync.py index 3b5a9470f9..f54dbe2d56 100644 --- a/nf_core/pipelines/sync.py +++ b/nf_core/pipelines/sync.py @@ -202,7 +202,7 @@ def inspect_sync_dir(self): # Track ignored files to avoid processing them self.ignored_files = self._get_ignored_files() - def get_wf_config(self): + def get_wf_config(self) -> None: """Check out the target branch if requested and fetch the nextflow config. Check that we have the required config variables. """ @@ -290,7 +290,7 @@ def _clean_up_empty_dirs(self): raise SyncExceptionError(e) deleted.add(Path(curr_dir)) - def make_template_pipeline(self): + def make_template_pipeline(self) -> None: """ Delete all files and make a fresh template using the workflow variables """ @@ -310,17 +310,12 @@ def make_template_pipeline(self): yaml.safe_dump(self.config_yml.model_dump(exclude_none=True), config_path) try: - try: - default_branch = self.wf_config.manifest.default_branch or "master" - except AttributeError: - default_branch = "master" - pipeline_create_obj = nf_core.pipelines.create.create.PipelineCreate( outdir=str(self.pipeline_dir), from_config_file=True, no_git=True, force=True, - default_branch=default_branch, + default_branch=self.wf_config.get("manifest.defaultBranch") or "master", ) pipeline_create_obj.init_pipeline()