Skip to content

Commit

Permalink
Merge pull request nf-core#3104 from mirpedrol/template-customisation…
Browse files Browse the repository at this point in the history
…-changelog

Template: add option to exclude changelog from custom pipeline template
  • Loading branch information
mirpedrol authored Aug 7, 2024
2 parents 442f0a8 + 8b196cd commit 614b79f
Show file tree
Hide file tree
Showing 6 changed files with 280 additions and 256 deletions.
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 @@ -45,6 +45,7 @@ jobs:
- "template_skip_citations.yml"
- "template_skip_gitpod.yml"
- "template_skip_multiqc.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 @@ -122,6 +123,10 @@ jobs:
run: |
printf "org: my-prefix\nskip: multiqc" > create-test-lint-wf/template_skip_multiqc.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 @@ -13,6 +13,7 @@
- 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 multiqc from pipeline template ([#3103](https://github.com/nf-core/tools/pull/3103))
- 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 @@ -108,6 +108,7 @@ def __init__(
"assets/methods_description_template.yml",
"modules/nf-core/multiqc/",
],
"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 @@ -220,6 +221,7 @@ def obtain_jinja_params_dict(self, features_to_skip, pipeline_dir):
"citations": {"file": True, "content": True},
"gitpod": {"file": True, "content": True},
"multiqc": {"file": True, "content": True},
"changelog": {"file": True, "content": False},
}

# Set the parameters for the jinja template
Expand Down Expand Up @@ -526,6 +528,10 @@ def fix_linting(self):
lint_config.setdefault("files_exist", []).extend(["assets/multiqc_config.yml"])
lint_config["multiqc_config"] = False

# 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 @@ -128,6 +133,12 @@ def compose(self) -> ComposeResult:
"The pipeline will include the MultiQC module which generates an HTML report for quality control.",
"multiqc",
),
PipelineFeature(
markdown_changelog,
"Add a changelog",
"Add a CHANGELOG.md file.",
"changelog",
),
classes="features-container",
)
yield Center(
Expand Down
512 changes: 256 additions & 256 deletions tests/__snapshots__/test_create_app.ambr

Large diffs are not rendered by default.

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 @@ -15,3 +15,4 @@ skip_features:
- citations
- gitpod
- multiqc
- changelog

0 comments on commit 614b79f

Please sign in to comment.