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

fix(pipeline-sync): Removes requirement to have authors defined #3393

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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 @@ -16,6 +16,7 @@

- Parameters schema validation: allow oneOf, anyOf and allOf with `required` ([#3386](https://github.com/nf-core/tools/pull/3386))
- Run pre-comit when rendering template for pipelines sync ([#3371](https://github.com/nf-core/tools/pull/3371))
- Remove requirement to have authors defined ([#3393](https://github.com/nf-core/tools/pull/3393))

### Version updates

Expand Down
11 changes: 7 additions & 4 deletions nf_core/pipelines/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ def __init__(
self.made_changes = False
self.make_pr = make_pr
self.gh_pr_returned_data: Dict = {}
self.required_config_vars = ["manifest.name", "manifest.description", "manifest.version", "manifest.author"]
self.required_config_vars = [
"manifest.name",
"manifest.description",
"manifest.version",
]
self.force_pr = force_pr

self.gh_username = gh_username
Expand Down Expand Up @@ -292,11 +296,10 @@ def make_template_pipeline(self):
# Update nf-core version
self.config_yml.nf_core_version = nf_core.__version__
dump_yaml_with_prettier(self.config_yml_path, self.config_yml.model_dump(exclude_none=True))

except Exception as err:
except Exception as e:
# Reset to where you were to prevent git getting messed up.
self.repo.git.reset("--hard")
mirpedrol marked this conversation as resolved.
Show resolved Hide resolved
raise SyncExceptionError(f"Failed to rebuild pipeline from template with error:\n{err}")
raise SyncExceptionError(f"Failed to rebuild pipeline from template with error:\n{e}")

def commit_template_changes(self):
"""If we have any changes with the new template files, make a git commit"""
Expand Down
26 changes: 22 additions & 4 deletions nf_core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,18 @@
import time
from contextlib import contextmanager
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, List, Literal, Optional, Tuple, Union
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
Generator,
List,
Literal,
Optional,
Tuple,
Union,
)

import git
import prompt_toolkit.styles
Expand Down Expand Up @@ -89,7 +100,10 @@
os.environ.get("XDG_CACHE_HOME", Path(os.getenv("HOME") or "", ".cache")),
"nfcore",
)
NFCORE_DIR = Path(os.environ.get("XDG_CONFIG_HOME", os.path.join(os.getenv("HOME") or "", ".config")), "nfcore")
NFCORE_DIR = Path(
os.environ.get("XDG_CONFIG_HOME", os.path.join(os.getenv("HOME") or "", ".config")),
"nfcore",
)


def fetch_remote_version(source_url):
Expand Down Expand Up @@ -942,7 +956,9 @@ def prompt_remote_pipeline_name(wfs):


def prompt_pipeline_release_branch(
wf_releases: List[Dict[str, Any]], wf_branches: Dict[str, Any], multiple: bool = False
wf_releases: List[Dict[str, Any]],
wf_branches: Dict[str, Any],
multiple: bool = False,
) -> Tuple[Any, List[str]]:
"""Prompt for pipeline release / branch

Expand Down Expand Up @@ -1332,8 +1348,10 @@ def load_tools_config(directory: Union[str, Path] = ".") -> Tuple[Optional[Path]
contributors = wf_config["manifest.contributors"]
names = re.findall(r"name:'([^']+)'", contributors)
author_names = ", ".join(names)
else:
elif "manifest.author" in wf_config:
author_names = wf_config["manifest.author"].strip("'\"")
else:
author_names = ""
if nf_core_yaml_config.template is None:
# The .nf-core.yml file did not contain template information
nf_core_yaml_config.template = NFCoreTemplateConfig(
Expand Down
Loading