From 59c6164c1f1ff252e85b3ef2678f630bd42c7b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Tue, 21 Dec 2021 16:15:12 +0100 Subject: [PATCH] depcheck: Commit updates automatically --- depcheck/update-cargo-dependencies.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/depcheck/update-cargo-dependencies.py b/depcheck/update-cargo-dependencies.py index acb8605..02acb84 100755 --- a/depcheck/update-cargo-dependencies.py +++ b/depcheck/update-cargo-dependencies.py @@ -63,12 +63,16 @@ for tier in ["dependencies", "dev-dependencies"]: f"{name}: New version found: {latest_version} (current {current_version})" ) cargo[tier][name]["version"] = f"={str(latest_version)}" + with open("../Cargo.toml", "w") as cargo_config: + cargo_config.write(tomlkit.dumps(cargo)) + + 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 True: - with open("../Cargo.toml", "w") as cargo_config: - cargo_config.write(tomlkit.dumps(cargo)) - sys.exit(1) -else: +if update_necessary is False: print("Everything up to date") - sys.exit(0)