Skip to content

Commit 094e3e1

Browse files
committed
tools/release.py: fail if worktree is dirty
Assisted-by: Claude Opus 4.5
1 parent 34b030c commit 094e3e1

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tools/release.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ def main():
2828
if tag_exists(tag):
2929
die(f"Tag {tag} already exists")
3030

31+
if is_worktree_dirty():
32+
die("Worktree is dirty, commit or stash changes first")
33+
3134
step("Verifying Cargo.lock is in sync...")
3235
run("just", "lockcheck")
3336

@@ -138,6 +141,11 @@ def tag_exists(tag: str) -> bool:
138141
return run_output("git", "tag", "-l", tag).strip() != ""
139142

140143

144+
def is_worktree_dirty() -> bool:
145+
"""Check if the git worktree has uncommitted changes."""
146+
return run_output("git", "status", "--porcelain").strip() != ""
147+
148+
141149
def fetch_release_notes(tag: str) -> str:
142150
"""Fetch auto-generated release notes from GitHub."""
143151
return run_output("gh", "api", "--method", "POST",

0 commit comments

Comments
 (0)