Skip to content

Commit

Permalink
Merge pull request #2820 from mashehu/fix-changelog-bot
Browse files Browse the repository at this point in the history
Changelog bot: handle also patch version before dev suffix
  • Loading branch information
mashehu committed Mar 1, 2024
2 parents 15e0044 + f65253c commit 721bab5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
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

0 comments on commit 721bab5

Please sign in to comment.