Merge pull request #16 from lifebottle/dev

Add function to refresh repo on the VM
This commit is contained in:
fortiersteven
2022-04-10 17:47:37 -04:00
committed by GitHub
3 changed files with 35 additions and 15 deletions

31
RepoFunctions.py Normal file
View File

@@ -0,0 +1,31 @@
import os
import requests
import json
import subprocess
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 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