Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NF-Core Sync includes template.yaml as option #1880

Merged
merged 7 commits into from
Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
### General

- Fix error in tagging GitPod docker images during releases
- `nf-core sync` now supports the template YAML file using `-t/--template-yaml`.
- Don't remove local copy of modules repo, only update it with fetch ([#1879](https://github.com/nf-core/tools/pull/1879))

### Modules
Expand Down
5 changes: 3 additions & 2 deletions nf_core/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,8 @@ def bump_version(new_version, dir, nextflow):
@click.option("-p", "--pull-request", is_flag=True, default=False, help="Make a GitHub pull-request with the changes.")
@click.option("-g", "--github-repository", type=str, help="GitHub PR: target repository.")
@click.option("-u", "--username", type=str, help="GitHub PR: auth username.")
def sync(dir, from_branch, pull_request, github_repository, username):
@click.option("-t", "--template-yaml", help="Pass a YAML file to customize the template")
def sync(dir, from_branch, pull_request, github_repository, username, template_yaml):
"""
Sync a pipeline [cyan i]TEMPLATE[/] branch with the nf-core template.

Expand All @@ -1071,7 +1072,7 @@ def sync(dir, from_branch, pull_request, github_repository, username):
nf_core.utils.is_pipeline_directory(dir)

# Sync the given pipeline dir
sync_obj = nf_core.sync.PipelineSync(dir, from_branch, pull_request, github_repository, username)
sync_obj = nf_core.sync.PipelineSync(dir, from_branch, pull_request, github_repository, username, template_yaml)
try:
sync_obj.sync()
except (nf_core.sync.SyncException, nf_core.sync.PullRequestException) as e:
Expand Down
1 change: 1 addition & 0 deletions nf_core/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class PipelineCreate(object):
force (bool): Overwrites a given workflow directory with the same name. Defaults to False.
May the force be with you.
outdir (str): Path to the local output directory.
template_yaml (str): Path to template.yml file for pipeline creation settings.
"""

def __init__(
Expand Down
5 changes: 5 additions & 0 deletions nf_core/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class PipelineSync(object):
required_config_vars (list): List of nextflow variables required to make template pipeline
gh_username (str): GitHub username
gh_repo (str): GitHub repository name
template_yaml (str): Path to template.yml file for pipeline creation settings.
"""

def __init__(
Expand All @@ -61,6 +62,7 @@ def __init__(
make_pr=False,
gh_repo=None,
gh_username=None,
template_yaml_path=None,
):
"""Initialise syncing object"""

Expand All @@ -77,6 +79,8 @@ def __init__(
self.gh_repo = gh_repo
self.pr_url = ""

self.template_yaml_path = template_yaml_path

# Set up the API auth if supplied on the command line
self.gh_api = nf_core.utils.gh_api
self.gh_api.lazy_init()
Expand Down Expand Up @@ -233,6 +237,7 @@ def make_template_pipeline(self):
force=True,
outdir=self.pipeline_dir,
author=self.wf_config["manifest.author"].strip('"').strip("'"),
template_yaml_path=self.template_yaml_path,
plain=True,
).init_pipeline()

Expand Down