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

Changelog bot: handle also patch version before dev suffix #2820

Merged
merged 7 commits into from
Mar 1, 2024
Merged
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
7 changes: 4 additions & 3 deletions .github/workflows/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def _determine_change_type(pr_title) -> tuple[str, str]:
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)
pr_title = re.sub(rf"{section}:[\s]*", "", pr_title, flags=re.IGNORECASE)

# Prepare the change log entry.
pr_link = f"([#{pr_number}]({REPO_URL}/pull/{pr_number}))"
Expand All @@ -91,7 +91,6 @@ def _determine_change_type(pr_title) -> tuple[str, str]:
new_lines = [
f"- {pr_title} {pr_link}\n",
]

print(f"Adding new lines into section '{section}':\n" + "".join(new_lines))

# Finally, updating the changelog.
Expand Down Expand Up @@ -144,10 +143,11 @@ def _skip_existing_entry_for_this_pr(line: str, same_section: bool = True) -> st

# Parse version from the line `## v2.12dev` or
# `## [v2.11.1 - Magnesium Dragon Patch](https://github.com/nf-core/tools/releases/tag/2.11) - [2023-12-20]` ...
if not (m := re.match(r".*(v\d+\.\d+(dev)?).*", line)):
if not (m := re.match(r".*(v\d+\.\d+.\d*(dev)?).*", line)):
print(f"Cannot parse version from line {line.strip()}.", file=sys.stderr)
sys.exit(1)
version = m.group(1)
print(f"Found version: {version}")

if not inside_version_dev:
if not version.endswith("dev"):
Expand Down Expand Up @@ -209,6 +209,7 @@ def _skip_existing_entry_for_this_pr(line: str, same_section: bool = True) -> st
# If the line already contains a link to the PR, don't add it again.
line = _skip_existing_entry_for_this_pr(line, same_section=True)
section_lines.append(line)

else:
updated_lines.append(line)

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

### General

- Changelog bot: handle also patch version before dev suffix ([#2820](https://github.com/nf-core/tools/pull/2820))

## [v2.13.1 - Tin Puppy Patch](https://github.com/nf-core/tools/releases/tag/2.13) - [2024-02-29]

### Template
Expand Down
Loading