Skip to content

Commit

Permalink
autoupdate fix
Browse files Browse the repository at this point in the history
  • Loading branch information
namoray committed Apr 9, 2024
1 parent deff62c commit f122818
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions run_autoupdater.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ def run_autoupdate(restart_script: str, process_pid: int):

while True:
local_tag = subprocess.getoutput("git describe --abbrev=0 --tags")
os.system(f"git fetch origin {branch_name}")
subprocess.run(["git fetch"], shell=True)
remote_tag = subprocess.getoutput(
f"git describe --tags `git rev-list --tags=origin/{branch_name} --max-count=1`"
)
print("branch nam:", branch_name)
print("localtag:", local_tag)
print("remotetag:", remote_tag)

if should_update_local(local_tag, remote_tag):
print("Local repo is not up-to-date. Updating...")
Expand All @@ -32,15 +35,15 @@ def run_autoupdate(restart_script: str, process_pid: int):

print("Running the autoupdate steps...")
# Trigger shell script. Make sure this file path starts from root
subprocess.run(["kill", f"{process_pid}"], shell=True)
subprocess.run(["wait", f"{process_pid}", "2>/dev/null"], shell=True)
subprocess.run(["kill {process_pid}"], shell=True)
subprocess.run(["wait {process_pid} 2>/dev/null"], shell=True)
subprocess.call([f"./{restart_script}"], shell=True)
print("Finished running the autoupdate steps! Ready to go 😎")

else:
print("Repo is up-to-date.")

time.sleep(60)
# Change after dev
time.sleep(5)


if __name__ == "__main__":
Expand All @@ -50,6 +53,4 @@ def run_autoupdate(restart_script: str, process_pid: int):
parser.add_argument("--restart_script", type=str)
parser.add_argument("--process_pid", type=int)
args = parser.parse_args()
run_autoupdate(
restart_script=args.restart_script, process_pid=args.process_pid
)
run_autoupdate(restart_script=args.restart_script, process_pid=args.process_pid)

0 comments on commit f122818

Please sign in to comment.