diff --git a/proton-checker.py b/proton-checker.py index 3189de6..19c9a8e 100644 --- a/proton-checker.py +++ b/proton-checker.py @@ -72,13 +72,23 @@ if __name__ == "__main__": print(f" {country_code}: {count}") # Git commands - try: +try: subprocess.run(["git", "add", output_file], check=True) - subprocess.run(["git", "commit", "-m", "Update ProtonVPN IP ranges"], check=True) - subprocess.run(["git", "push", "origin"], check=True) - print("Changes pushed to git repository.") - except subprocess.CalledProcessError as e: - print(f"Error running git commands: {e}") + + # Attempt to commit, but allow for no changes + commit_result = subprocess.run(["git", "commit", "-m", "Update ProtonVPN IP ranges"], check=False) + + if commit_result.returncode == 0: + # Commit was successful (changes were made) + subprocess.run(["git", "push", "origin"], check=True) + print("Changes pushed to git repository.") + else: + # No changes to commit + print("No changes to ProtonVPN IP ranges.") + +except subprocess.CalledProcessError as e: + # Handle other git errors + print(f"Error running git commands: {e}") # ping health system try: