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

Template: add option to exclude changelog from custom pipeline template #3104

Merged
merged 4 commits into from
Aug 7, 2024
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
5 changes: 5 additions & 0 deletions .github/workflows/create-test-lint-wf-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
- "template_skip_code_linters.yml"
- "template_skip_citations.yml"
- "template_skip_gitpod.yml"
- "template_skip_changelog.yml"
runner:
# use the runner given by the input if it is dispatched manually, run on github if it is a rerun or on self-hosted by default
- ${{ github.event.inputs.runners || github.run_number > 1 && 'ubuntu-latest' || 'self-hosted' }}
Expand Down Expand Up @@ -117,6 +118,10 @@ jobs:
run: |
printf "org: my-prefix\nskip: gitpod" > create-test-lint-wf/template_skip_gitpod.yml

- name: Create template skip changelog
run: |
printf "org: my-prefix\nskip: changelog" > create-test-lint-wf/template_skip_changelog.yml

# Create a pipeline from the template
- name: create a pipeline from the template ${{ matrix.TEMPLATE }}
run: |
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- add option to exclude code linters for custom pipeline template ([#3084](https://github.com/nf-core/tools/pull/3084))
- add option to exclude citations for custom pipeline template ([#3101](https://github.com/nf-core/tools/pull/3101))
- add option to exclude gitpod for custom pipeline template ([#3100](https://github.com/nf-core/tools/pull/3100))
- add option to exclude changelog from custom pipeline template ([#3104](https://github.com/nf-core/tools/pull/3104))

### Linting

Expand Down
6 changes: 6 additions & 0 deletions nf_core/pipelines/create/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ def __init__(
],
"citations": ["assets/methods_description_template.yml"],
"gitpod": [".gitpod.yml"],
"changelog": ["CHANGELOG.md"],
}
# Get list of files we're skipping with the supplied skip keys
self.skip_paths = set(sp for k in skip_paths for sp in skippable_paths[k])
Expand Down Expand Up @@ -214,6 +215,7 @@ def obtain_jinja_params_dict(self, features_to_skip, pipeline_dir):
"code_linters": {"file": True, "content": True},
"citations": {"file": True, "content": True},
"gitpod": {"file": True, "content": True},
"changelog": {"file": True, "content": False},
}

# Set the parameters for the jinja template
Expand Down Expand Up @@ -509,6 +511,10 @@ def fix_linting(self):
if not self.jinja_params["github_badges"] or not self.jinja_params["github"]:
lint_config["readme"] = ["nextflow_badge"]

# Add changelog specific configurations
if not self.jinja_params["changelog"]:
lint_config["files_exist"].extend(["CHANGELOG.md"])

# If the pipeline is not nf-core
if not self.config.is_nfcore:
lint_config["files_unchanged"].extend([".github/ISSUE_TEMPLATE/bug_report.yml"])
Expand Down
11 changes: 11 additions & 0 deletions nf_core/pipelines/create/custompipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@
This is useful to have all the tools ready for pipeline development.
"""

markdown_changelog = """
Having a `CHANGELOG.md` file in the pipeline root directory is useful to track the changes added to each version.
You can read more information on the recommended format here: https://keepachangelog.com/en/1.0.0/
"""


class CustomPipeline(Screen):
"""Select if the pipeline will use genomic data."""
Expand Down Expand Up @@ -122,6 +127,12 @@ def compose(self) -> ComposeResult:
"Include the configuration required to use Gitpod.",
"gitpod",
),
PipelineFeature(
markdown_changelog,
"Add a changelog",
"Add a CHANGELOG.md file.",
"changelog",
),
classes="features-container",
)
yield Center(
Expand Down
1 change: 1 addition & 0 deletions tests/data/pipeline_create_template_skip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ skip_features:
- code_linters
- citations
- gitpod
- changelog
Loading