From eb895dc0b38d2295133d55fbc8db5dba307406e0 Mon Sep 17 00:00:00 2001 From: mashehu Date: Tue, 9 Jan 2024 11:43:17 +0100 Subject: [PATCH 1/9] Template: switch to new image syntax in readme # Conflicts: # nf_core/pipeline-template/README.md --- README.md | 5 ++++- nf_core/pipeline-template/README.md | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3a9b31187a..87a125ecc5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ -# ![nf-core/tools](docs/images/nfcore-tools_logo_light.png#gh-light-mode-only) ![nf-core/tools](docs/images/nfcore-tools_logo_dark.png#gh-dark-mode-only) + + + nf-core/tools logo + [![Python tests](https://github.com/nf-core/tools/workflows/Python%20tests/badge.svg?branch=master&event=push)](https://github.com/nf-core/tools/actions?query=workflow%3A%22Python+tests%22+branch%3Amaster) [![codecov](https://codecov.io/gh/nf-core/tools/branch/master/graph/badge.svg)](https://codecov.io/gh/nf-core/tools) diff --git a/nf_core/pipeline-template/README.md b/nf_core/pipeline-template/README.md index c874090b51..908a48f504 100644 --- a/nf_core/pipeline-template/README.md +++ b/nf_core/pipeline-template/README.md @@ -1,7 +1,9 @@ {% if branded -%} + -# ![{{ name }}](docs/images/{{ logo_light }}#gh-light-mode-only) ![{{ name }}](docs/images/{{ logo_dark }}#gh-dark-mode-only) - + + {{ name }} logo + {% endif -%} {% if github_badges -%} [![GitHub Actions CI Status](https://github.com/{{ name }}/workflows/nf-core%20CI/badge.svg)](https://github.com/{{ name }}/actions?query=workflow%3A%22nf-core+CI%22) From ce4cf36b72ffafbc2543fe2f49e6f09e14b7e997 Mon Sep 17 00:00:00 2001 From: mashehu Date: Tue, 9 Jan 2024 12:01:55 +0100 Subject: [PATCH 2/9] add a bit more logging to changelog script --- .github/workflows/changelog.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/.github/workflows/changelog.py b/.github/workflows/changelog.py index 2ce14e60b3..7499c3d339 100644 --- a/.github/workflows/changelog.py +++ b/.github/workflows/changelog.py @@ -16,7 +16,6 @@ import os import re -import subprocess import sys from pathlib import Path from typing import List @@ -51,14 +50,6 @@ sys.exit(0) -def _run_cmd(cmd): - print(cmd) - result = subprocess.run(cmd, shell=True, capture_output=True, text=True) - if result.returncode != 0: - raise RuntimeError(f"Error executing command: {result.stderr}") - return result - - def _determine_change_type(pr_title) -> str: """ Determine the type of the PR: Template, Download, Linting, Modules, Subworkflows, or General @@ -78,11 +69,11 @@ def _determine_change_type(pr_title) -> str: # check if the PR title contains any of the section headers, with some loose matching, e.g. removing plural and suffixes if re.sub(r"s$", "", section.lower().replace("ing", "")) in pr_title.lower(): current_section = section_header - + print(f"Detected section: {current_section}") return current_section -# Determine the type of the PR: new module, module update, or core update. +# Determine the type of the PR section = _determine_change_type(pr_title) # Remove section indicator from the PR title. @@ -93,11 +84,14 @@ def _determine_change_type(pr_title) -> str: # Handle manual changelog entries through comments. if comment := comment.removeprefix("@nf-core-bot changelog").strip(): + print(f"Adding manual changelog entry: {comment}") pr_title = comment new_lines = [ f"- {pr_title} {pr_link}\n", ] +print(f"Adding new lines into section '{section}':\n" + "".join(new_lines)) + # Finally, updating the changelog. # Read the current changelog lines. We will print them back as is, except for one new # entry, corresponding to this new PR. @@ -126,7 +120,7 @@ def _skip_existing_entry_for_this_pr(line: str, same_section: bool = True) -> st return line -# Find the next line in the change log that matches the pattern "## MultiQC v.*dev" +# Find the next line in the change log that matches the pattern "# nf-core/tools v.*dev" # If it doesn't exist, exist with code 1 (let's assume that a new section is added # manually or by CI when a release is pushed). # Else, find the next line that matches the `section` variable, and insert a new line From 6693377949e1e7baec88f54a4c895da2adb86ecb Mon Sep 17 00:00:00 2001 From: mashehu Date: Tue, 9 Jan 2024 12:05:18 +0100 Subject: [PATCH 3/9] more debugging --- .github/workflows/changelog.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/changelog.py b/.github/workflows/changelog.py index 7499c3d339..36668efed4 100644 --- a/.github/workflows/changelog.py +++ b/.github/workflows/changelog.py @@ -117,6 +117,7 @@ def _skip_existing_entry_for_this_pr(line: str, same_section: bool = True) -> st line = orig_lines.pop(0) except IndexError: break + print(f"Skipping line: {line.strip()}") return line @@ -182,7 +183,7 @@ def _skip_existing_entry_for_this_pr(line: str, same_section: bool = True) -> st section_lines: List[str] = [] while True: line = orig_lines.pop(0) - if line.startswith("#"): + if line.startswith("###"): # Found the next section header, so need to put all the lines we collected. updated_lines.append("\n") _updated_lines = [_l for _l in section_lines + new_lines if _l.strip()] From ffe1dd62bee297c4652ee65e37a51263083d5b7d Mon Sep 17 00:00:00 2001 From: mashehu Date: Tue, 9 Jan 2024 12:12:59 +0100 Subject: [PATCH 4/9] fix section selection --- .github/workflows/changelog.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/changelog.py b/.github/workflows/changelog.py index 36668efed4..af3a9d68c4 100644 --- a/.github/workflows/changelog.py +++ b/.github/workflows/changelog.py @@ -50,7 +50,7 @@ sys.exit(0) -def _determine_change_type(pr_title) -> str: +def _determine_change_type(pr_title) -> tuple[str, str]: """ Determine the type of the PR: Template, Download, Linting, Modules, Subworkflows, or General Returns a tuple of the section name and the module info. @@ -62,19 +62,21 @@ def _determine_change_type(pr_title) -> str: "Modules": "### Modules", "Subworkflows": "### Subworkflows", } - current_section = "### General" + current_section_header = "### General" + current_section = "General" # Check if the PR in any of the sections. for section, section_header in sections.items(): # check if the PR title contains any of the section headers, with some loose matching, e.g. removing plural and suffixes if re.sub(r"s$", "", section.lower().replace("ing", "")) in pr_title.lower(): - current_section = section_header + current_section_header = section_header + current_section = section print(f"Detected section: {current_section}") - return current_section + return current_section, current_section_header # Determine the type of the PR -section = _determine_change_type(pr_title) +section, section_header = _determine_change_type(pr_title) # Remove section indicator from the PR title. pr_title = re.sub(rf"{section}[:\s]*", "", pr_title, flags=re.IGNORECASE) @@ -171,7 +173,7 @@ def _skip_existing_entry_for_this_pr(line: str, same_section: bool = True) -> st break continue - if inside_version_dev and line.lower().startswith(section.lower()): # Section of interest header + if inside_version_dev and line.lower().startswith(section_header.lower()): # Section of interest header if already_added_entry: print( f"Already added new lines into section {section}, is the section duplicated?", From 792f2a22d567bcde10f4015f6db31577ee039f0d Mon Sep 17 00:00:00 2001 From: mashehu Date: Tue, 9 Jan 2024 12:17:18 +0100 Subject: [PATCH 5/9] more debugging --- .github/workflows/changelog.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/changelog.py b/.github/workflows/changelog.py index af3a9d68c4..88e3bf4a98 100644 --- a/.github/workflows/changelog.py +++ b/.github/workflows/changelog.py @@ -174,6 +174,7 @@ def _skip_existing_entry_for_this_pr(line: str, same_section: bool = True) -> st continue if inside_version_dev and line.lower().startswith(section_header.lower()): # Section of interest header + print(f"Found section header: {line.strip()}") if already_added_entry: print( f"Already added new lines into section {section}, is the section duplicated?", @@ -185,7 +186,8 @@ def _skip_existing_entry_for_this_pr(line: str, same_section: bool = True) -> st section_lines: List[str] = [] while True: line = orig_lines.pop(0) - if line.startswith("###"): + if line.startswith("#"): + print(f"Found the next section header: {line.strip()}") # Found the next section header, so need to put all the lines we collected. updated_lines.append("\n") _updated_lines = [_l for _l in section_lines + new_lines if _l.strip()] From ef18ea4d367833f4fd3901f44d62c2ea385fe9e5 Mon Sep 17 00:00:00 2001 From: mashehu Date: Tue, 9 Jan 2024 12:36:41 +0100 Subject: [PATCH 6/9] debugging --- .github/workflows/changelog.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/changelog.py b/.github/workflows/changelog.py index 88e3bf4a98..318ed7c295 100644 --- a/.github/workflows/changelog.py +++ b/.github/workflows/changelog.py @@ -104,6 +104,7 @@ def _determine_change_type(pr_title) -> tuple[str, str]: def _skip_existing_entry_for_this_pr(line: str, same_section: bool = True) -> str: if line.strip().endswith(pr_link): + print(f"Found existing entry for this pull request #{pr_number}:") existing_lines = [line] if new_lines and new_lines == existing_lines and same_section: print(f"Found existing identical entry for this pull request #{pr_number} in the same section:") @@ -119,7 +120,6 @@ def _skip_existing_entry_for_this_pr(line: str, same_section: bool = True) -> st line = orig_lines.pop(0) except IndexError: break - print(f"Skipping line: {line.strip()}") return line @@ -137,6 +137,7 @@ def _skip_existing_entry_for_this_pr(line: str, same_section: bool = True) -> st line = _skip_existing_entry_for_this_pr(line, same_section=False) if line.startswith("# ") and not line.strip() == "# nf-core/tools: Changelog": # Version header, e.g. "# v2.12dev" + print(f"Found version header: {line.strip()}") updated_lines.append(line) # Parse version from the line `# v2.12dev` or From a82d9cc3ec5968b8125a46c3fd8bee77b253ee4a Mon Sep 17 00:00:00 2001 From: mashehu Date: Tue, 9 Jan 2024 12:39:37 +0100 Subject: [PATCH 7/9] debugging --- .github/workflows/changelog.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/changelog.py b/.github/workflows/changelog.py index 318ed7c295..8c8ae0c57f 100644 --- a/.github/workflows/changelog.py +++ b/.github/workflows/changelog.py @@ -173,7 +173,9 @@ def _skip_existing_entry_for_this_pr(line: str, same_section: bool = True) -> st updated_lines.append(line) break continue - + print(f"Found line: {line.strip()}") + print(f"inside_version_dev: {inside_version_dev}") + print(f"section_header: {section_header}") if inside_version_dev and line.lower().startswith(section_header.lower()): # Section of interest header print(f"Found section header: {line.strip()}") if already_added_entry: From 197617ff363530b095b083ae192e64a87179765c Mon Sep 17 00:00:00 2001 From: mashehu Date: Tue, 9 Jan 2024 12:41:33 +0100 Subject: [PATCH 8/9] fix section headers --- .github/workflows/changelog.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/changelog.py b/.github/workflows/changelog.py index 8c8ae0c57f..eb56499c93 100644 --- a/.github/workflows/changelog.py +++ b/.github/workflows/changelog.py @@ -56,9 +56,9 @@ def _determine_change_type(pr_title) -> tuple[str, str]: Returns a tuple of the section name and the module info. """ sections = { - "Template": "### Template updates", - "Download": "### Download updates", - "Linting": "### Linting updates", + "Template": "### Template", + "Download": "### Download", + "Linting": "### Linting", "Modules": "### Modules", "Subworkflows": "### Subworkflows", } From 403a6aaa0e4a72684acdd1ab07110a088f6fb4f5 Mon Sep 17 00:00:00 2001 From: nf-core-bot Date: Tue, 9 Jan 2024 11:42:18 +0000 Subject: [PATCH 9/9] [automated] Update CHANGELOG.md [no ci] --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4bcbce645..da10e94cb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Use `pre-commit` to lint files in GitHub CI ([#2635](https://github.com/nf-core/tools/pull/2635)) - Use pdiff also on gitpod for nf-test ([#2640](https://github.com/nf-core/tools/pull/2640)) +- switch to new image syntax in readme ([#2645](https://github.com/nf-core/tools/pull/2645)) ### Download