Adding function to refresh repo on the VM

This commit is contained in:
Stewie
2022-04-10 17:46:47 -04:00
parent 2f642db61a
commit 63d50555f2
3 changed files with 17 additions and 16 deletions

View File

@@ -1,5 +1,7 @@
import os
import requests
import json
import subprocess
def get_Releases(org, repo_name, latest=False):
@@ -16,4 +18,14 @@ def get_Releases(org, repo_name, latest=False):
res = requests.get(git_url)
json_res = json.loads(res.text)
return json_res
return json_res
def refresh_repo(repo_name):
base_path = os.path.join(os.getcwd(), "..", repo_name)
print("Repo to refresh: {}".format(base_path))
listFile = subprocess.run(
["git", "pull", repo_name],
cwd=base_path
)

View File

@@ -8,6 +8,7 @@ import re
import requests
import subprocess
import ApacheAutomate
import RepoFunctions
SCRIPT_VERSION = "0.3"
@@ -16,22 +17,7 @@ def generate_xdelta_patch(original_path, new_path, xdelta_name="Tales-Of-Rebirth
subprocess.run(["xdelta", "-s", original_path, new_path, xdelta_name])
def get_Releases(org, repo_name, latest=False):
#git_url = "https://api.github.com/repos/SymphoniaLauren/Tales-of-Rebirth/releases"
git_url = "https://api.github.com/repos/{}/{}/releases".format(org, repo_name)
if latest:
git_url = git_url+"/latest"
header = {
"Accept":"application/vnd.github.v3+json"
}
res = requests.get(git_url)
json_res = json.loads(res.text)
return json_res
def get_directory_path(path):
return os.path.dirname(os.path.abspath(path))
@@ -208,6 +194,9 @@ if __name__ == "__main__":
tales_instance.bytes_to_text_with_offset( args.param1, int(args.param2))
if args.action == "pack":
RepoFunctions.refresh_repo("PythonLib")
RepoFunctions.refresh_repo("Tales-Of-Rebirth")
if args.file == "SLPS":
#SLPS