31 lines
894 B
Python
31 lines
894 B
Python
#!/usr/bin/env python3
|
|
|
|
import os
|
|
import subprocess
|
|
import argparse
|
|
|
|
# Define and parse command-line arguments
|
|
parser = argparse.ArgumentParser(description="Automate Git add, commit, and push operations.")
|
|
parser.add_argument("--COMMIT-MSG", help="Commit message for the changes.")
|
|
args = parser.parse_args()
|
|
|
|
# Get the commit message from command-line argument or prompt user
|
|
if args.COMMIT_MSG:
|
|
commit_msg = args.COMMIT_MSG
|
|
else:
|
|
commit_msg = input("Enter commit message: ")
|
|
|
|
# Add changes to the staging area
|
|
subprocess.run(["python3", "./scripts/list_new_docker_files.py", "--replace"], check=True)
|
|
|
|
# Add changes to the staging area
|
|
subprocess.run(["git", "add", "."], check=True)
|
|
|
|
# Commit changes
|
|
subprocess.run(["git", "commit", "-m", commit_msg], check=True)
|
|
|
|
# Push changes
|
|
subprocess.run(["git", "push"], check=True)
|
|
|
|
print("Changes have been added, committed, and pushed.")
|