Skip to content

Commit dbab9e6

Browse files
committed
The file status check should be put at the start. To reduce side effect
1 parent d486c4c commit dbab9e6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

scripts/bump_version.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ def contains_uncommitted_change(filepath: str):
6565
@click.argument("component")
6666
@click.option("--no-release", is_flag=True)
6767
def main(component: str, no_release: bool) -> None:
68+
if contains_uncommitted_change("README.md"):
69+
raise RuntimeError(
70+
"README.md contains uncommitted change. "
71+
"Please clean it up before rerun the script."
72+
)
73+
6874
print("Calculating new version......")
6975

7076
old_version_info = semver.VersionInfo.parse(current_version.lstrip("v"))
@@ -87,11 +93,6 @@ def main(component: str, no_release: bool) -> None:
8793

8894
run(["git", "add", "fetcher/__version__.py"])
8995

90-
if contains_uncommitted_change("README.md"):
91-
raise RuntimeError(
92-
"README.md contains uncommitted change. "
93-
"Please clean it up before rerun the script."
94-
)
9596
run(["git", "add", "README.md"])
9697

9798
print("Committing the special commit for bumping version......")

0 commit comments

Comments
 (0)