@@ -120,6 +120,7 @@ def get_latest_commit_message() -> str:
120
120
stdout = subprocess .PIPE ,
121
121
stderr = subprocess .PIPE ,
122
122
text = True ,
123
+ encoding = "utf-8" ,
123
124
).stdout .strip ()
124
125
logger .debug (f"Latest commit message: { message } " )
125
126
return message
@@ -201,7 +202,11 @@ def bump_version(part: str) -> None:
201
202
subprocess.CalledProcessError: If bump2version fails.
202
203
"""
203
204
try :
204
- subprocess .run (["bump2version" , part ], check = True )
205
+ subprocess .run (
206
+ ["bump2version" , part ],
207
+ check = True ,
208
+ encoding = "utf-8" ,
209
+ )
205
210
logger .info (f"Successfully bumped the { part } version." )
206
211
except subprocess .CalledProcessError as error :
207
212
logger .error (f"Failed to bump the { part } version: { error } " )
@@ -216,7 +221,11 @@ def stage_changes(pyproject_path: str = "pyproject.toml") -> None:
216
221
pyproject_path (str): Path to the file to stage.
217
222
"""
218
223
try :
219
- subprocess .run (["git" , "add" , pyproject_path ], check = True )
224
+ subprocess .run (
225
+ ["git" , "add" , pyproject_path ],
226
+ check = True ,
227
+ encoding = "utf-8" ,
228
+ )
220
229
logger .debug (f"Staged { pyproject_path } for commit." )
221
230
except subprocess .CalledProcessError as e :
222
231
logger .error (f"Failed to stage { pyproject_path } : { e } " )
@@ -235,10 +244,14 @@ def amend_commit(new_commit_msg: str) -> None:
235
244
"""
236
245
try :
237
246
# Amend the commit with the new commit message
238
- subprocess .run (["git" , "commit" , "--amend" , "-m" , new_commit_msg ], check = True )
247
+ subprocess .run (
248
+ ["git" , "commit" , "--amend" , "-m" , new_commit_msg ],
249
+ check = True ,
250
+ encoding = "utf-8" ,
251
+ )
239
252
logger .info ("Successfully amended the commit with the new version bump." )
240
253
logger .info (
241
- "Please perform a push using 'git push' to update the remote repository. Avoid use --force"
254
+ "Please perform a push using 'git push' to update the remote repository. Avoid using --force"
242
255
)
243
256
except subprocess .CalledProcessError as e :
244
257
logger .error (f"Failed to amend the commit: { e } " )
@@ -283,7 +296,7 @@ def main() -> None:
283
296
amend_commit (updated_commit_msg )
284
297
285
298
logger .info (
286
- "Aborting the current push. Please perform a push using 'git push'. Avoid use --force"
299
+ "Aborting the current push. Please perform a push using 'git push'. Avoid using --force"
287
300
)
288
301
sys .exit (1 )
289
302
else :
0 commit comments