Skip to content

Commit

Permalink
Update gen_releasenotes
Browse files Browse the repository at this point in the history
  • Loading branch information
Limych committed Jan 5, 2022
1 parent 5a0449f commit b223f2a
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions bin/gen_releasenotes
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import argparse
import logging
import os
import re
import subprocess
from datetime import datetime
from typing import List, Optional, Tuple

from awesomeversion.match import is_pep440
from github import Github, GithubException, Repository, Tag
from packaging.version import Version

Expand All @@ -19,7 +19,7 @@ logging.basicConfig(level=logging.CRITICAL)

_LOGGER = logging.getLogger(__name__)

VERSION = "1.2.0"
VERSION = "1.2.1"

ROOT = os.path.dirname(os.path.abspath(f"{__file__}/.."))

Expand All @@ -40,6 +40,16 @@ BODY = """
CHANGE = "- [{line}]({link}) @{author}\n"
NOCHANGE = "_No changes in this release._"

RE_PEP440 = re.compile(
r"([1-9][0-9]*!)?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*((a|b|rc)"
r"(0|[1-9][0-9]*))?(\.post(0|[1-9][0-9]*))?(\.dev(0|[1-9][0-9]*))?(\.rc(0|[1-9][0-9]*))?"
)


def is_pep440(version: str) -> bool:
"""Return True if the version is PEP 440 compliant."""
return bool(RE_PEP440.match(version))


def get_commits(repo: Repository, since: datetime, until: datetime):
"""Get commits in repo."""
Expand Down Expand Up @@ -222,12 +232,7 @@ def main():
_LOGGER.debug(version)
new_version = bump_version(version)
_LOGGER.debug(new_version)
print(
"Generated release notes for v{version}:\n{message}".format(
version=new_version,
message=changes,
)
)
print(f"Generated release notes for v{new_version}:\n{changes}")
else:
print("Not enough changes for a release.")
else:
Expand Down

0 comments on commit b223f2a

Please sign in to comment.