File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -283,18 +283,21 @@ def _publish(
283283 dry_run : bool ,
284284 skip_git_checks : bool ,
285285) -> str | None :
286- if not skip_git_checks :
287- if not _is_working_tree_clean ():
286+ if not _is_working_tree_clean ():
287+ if skip_git_checks :
288+ warning ("Working tree is not clean. Bypassing this check due to the --force flag." )
289+ else :
288290 error (
289291 "Working tree is not clean. Commit, stash, or clean changes before publishing "
290292 "(use --force to override)."
291293 )
292294 raise typer .Exit (1 )
293- if not _is_on_main_branch ():
295+ if not _is_on_main_branch ():
296+ if skip_git_checks :
297+ warning ("Not on the main branch. Bypassing this check due to the --force flag." )
298+ else :
294299 error ("Publishing is only supported from the main branch. Switch to 'main' or pass --force to override." )
295300 raise typer .Exit (1 )
296- else :
297- warning ("Force mode enabled: branch and clean checks were bypassed." )
298301
299302 info (f"Refreshing tags from { remote } ..." )
300303 gitta .run_git ("fetch" , remote , "--tags" , "--force" )
You can’t perform that action at this time.
0 commit comments