Skip to content

Commit 925b583

Browse files
committed
✨ feat(core): icons parse [patch candidate]
1 parent 29d20d6 commit 925b583

File tree

2 files changed

+6
-11
lines changed

2 files changed

+6
-11
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ repos:
6666
files: ^docker-compose(\.dev|\.prod)?\.yml$
6767
- id: validate-commit
6868
name: validate-commit
69-
entry: python control_commit/main.py --log-level=DEBUG
69+
entry: python control_commit/main.py --log-level=INFO
7070
always_run: true
7171
pass_filenames: false
7272
language: system
7373
stages: [pre-push]
7474
- id: commit-msg-version-check
7575
name: commit-msg-version-check
76-
entry: python commit_msg_version_bump/main.py --log-level=INFO
76+
entry: python commit_msg_version_bump/main.py --log-level=DEBUG
7777
always_run: true
7878
language: system
7979
pass_filenames: false

commit_msg_version_bump/main.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -171,21 +171,18 @@ def get_new_version(pyproject_path: str = "pyproject.toml") -> str:
171171
sys.exit(1)
172172

173173

174-
def add_icon_and_prepare_commit_message(
175-
commit_type: str, current_version: str, new_version: str
176-
) -> str:
174+
def add_icon_and_prepare_commit_message(current_version: str, new_version: str) -> str:
177175
"""
178176
Prepares the new commit message with the icon and version bump.
179177
180178
Args:
181-
commit_type (str): The type of the commit (e.g., 'chore', 'fix').
182179
current_version (str): The current version before bump.
183180
new_version (str): The new version after bump.
184181
185182
Returns:
186183
str: The new commit message.
187184
"""
188-
icon = TYPE_MAPPING.get(commit_type.lower(), "")
185+
icon = "🔖"
189186
new_commit_msg = f"{icon} Bump version: {current_version}{new_version}"
190187
logger.debug(f"New commit message: {new_commit_msg}")
191188
return new_commit_msg
@@ -272,7 +269,6 @@ def main() -> None:
272269
commit_type = type_match.group("type")
273270
logger.debug(f"Detected commit type: {commit_type}")
274271
else:
275-
commit_type = "chore" # Default to 'chore' if no type is found
276272
logger.debug("No commit type detected. Defaulting to 'chore'.")
277273

278274
version_bump_part = determine_version_bump(latest_commit_msg)
@@ -286,9 +282,7 @@ def main() -> None:
286282

287283
new_version = get_new_version()
288284

289-
updated_commit_msg = add_icon_and_prepare_commit_message(
290-
commit_type, current_version, new_version
291-
)
285+
updated_commit_msg = add_icon_and_prepare_commit_message(current_version, new_version)
292286

293287
# Stage the updated pyproject.toml
294288
stage_changes()
@@ -313,6 +307,7 @@ def determine_version_bump(commit_msg: str) -> Optional[str]:
313307
Returns:
314308
Optional[str]: The version part to bump ('major', 'minor', 'patch') or None.
315309
"""
310+
logger.debug(f"Detected commit message: {commit_msg}")
316311
match = VERSION_KEYWORD_REGEX.search(commit_msg)
317312
if match:
318313
keyword = match.group("keyword").lower()

0 commit comments

Comments
 (0)