Skip to content

Commit af8caa6

Browse files
author
Ben Du
committed
add function to transform version semantic
1 parent 8456ffe commit af8caa6

3 files changed

Lines changed: 69 additions & 47 deletions

File tree

github_rest_api/actions/utils.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,25 @@ def commit_profiling(prof_dir: str | Path):
7373
"""
7474
porcelain.add(paths=prof_dir)
7575
porcelain.commit(message="Updating profiling results.")
76+
77+
78+
def strip_patch_version(version: str) -> str:
79+
parts = version.split(".")
80+
match len(parts):
81+
case 1:
82+
return parts[0] + ".0.0"
83+
case 2 | 3:
84+
return ".".join(parts[:2]) + ".0"
85+
case _:
86+
raise ValueError("Invalid version semantic provided!")
87+
88+
89+
def strip_minor_version(version: str) -> str:
90+
parts = version.split(".")
91+
match len(parts):
92+
case 1:
93+
return parts[0] + ".0.0"
94+
case 2 | 3:
95+
return ".".join(parts[:1]) + ".0.0"
96+
case _:
97+
raise ValueError("Invalid version semantic provided!")

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "github_rest_api"
3-
version = "0.27.0"
3+
version = "0.28.0"
44
description = "Simple wrapper of GitHub REST APIs."
55
authors = [{ name = "Ben Du", email = "longendu@yahoo.com" }]
66
requires-python = ">=3.11,<4"

0 commit comments

Comments
 (0)