depcheck: Commit updates automatically

This commit is contained in:
2021-12-21 16:15:12 +01:00
parent 4722d5a8ff
commit 59c6164c1f

View File

@@ -63,12 +63,16 @@ for tier in ["dependencies", "dev-dependencies"]:
f"{name}: New version found: {latest_version} (current {current_version})" f"{name}: New version found: {latest_version} (current {current_version})"
) )
cargo[tier][name]["version"] = f"={str(latest_version)}" cargo[tier][name]["version"] = f"={str(latest_version)}"
if update_necessary is True:
with open("../Cargo.toml", "w") as cargo_config: with open("../Cargo.toml", "w") as cargo_config:
cargo_config.write(tomlkit.dumps(cargo)) cargo_config.write(tomlkit.dumps(cargo))
sys.exit(1)
else: message = f"dependencies: Update {name} to {latest_version}"
subprocess.run(
["git", "commit", "--message", message, "../Cargo.toml"],
check=True,
capture_output=True
)
if update_necessary is False:
print("Everything up to date") print("Everything up to date")
sys.exit(0)