Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Sep 14, 2024
1 parent cdabc45 commit 45d5f37
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ flake8 = "^7"
mypy = "^1.5"
pytest-cov = "^5.0.0"

[tool.black]
line-length = 88

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
13 changes: 7 additions & 6 deletions tagbot/action/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,22 @@ def _previous_release(self, version_tag: str) -> Optional[GitRelease]:
prev_ver = ver
return prev_rel

VERSION_PATTERN = re.compile(r"^(.*?)[-v]?(\d+\.\d+\.\d+(?:\.\d+)*)(?:[-+].+)?$")

def _is_backport(self, version: str) -> bool:
"""Determine whether or not the version is a backport."""
try:
# Extract the version number from the input
match = VERSION_PATTERN.match(version)
version_pattern = re.compile(
r"^(.*?)[-v]?(\d+\.\d+\.\d+(?:\.\d+)*)(?:[-+].+)?$"
)

# Extract any package name prefix and version number from the input
match = version_pattern.match(version)
if not match:
raise ValueError(f"Invalid version format: {version}")

package_name = match.group(1)
cur_ver = VersionInfo.parse(match.group(2))

for r in self._repo._repo.get_releases():
tag_match = VERSION_PATTERN.match(r.tag_name)
tag_match = version_pattern.match(r.tag_name)
if not tag_match:
continue

Expand Down

0 comments on commit 45d5f37

Please sign in to comment.