Return URL where they can view changes and open PR
This commit is contained in:
parent
679a111725
commit
fc558b2218
|
@ -470,7 +470,7 @@ paths:
|
||||||
content:
|
content:
|
||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/components/schemas/OkTrue"
|
type: string
|
||||||
|
|
||||||
/processes:
|
/processes:
|
||||||
get:
|
get:
|
||||||
|
|
|
@ -377,8 +377,9 @@ def process_model_publish(
|
||||||
if branch_to_update is None:
|
if branch_to_update is None:
|
||||||
branch_to_update = current_app.config["GIT_MERGE_BRANCH"]
|
branch_to_update = current_app.config["GIT_MERGE_BRANCH"]
|
||||||
process_model_identifier = un_modify_modified_process_model_id(modified_process_model_identifier)
|
process_model_identifier = un_modify_modified_process_model_id(modified_process_model_identifier)
|
||||||
GitService().publish(process_model_identifier, branch_to_update)
|
pr_url = GitService().publish(process_model_identifier, branch_to_update)
|
||||||
return Response(json.dumps({"ok": True}), status=200, mimetype="application/json")
|
data = {"ok": True, "pr_url": pr_url}
|
||||||
|
return Response(json.dumps(data), status=200, mimetype="application/json")
|
||||||
|
|
||||||
|
|
||||||
def process_model_list(
|
def process_model_list(
|
||||||
|
|
|
@ -94,4 +94,15 @@ class GitService:
|
||||||
commit_message = f"Request to publish changes to {process_model_id}, from {g.user.username}"
|
commit_message = f"Request to publish changes to {process_model_id}, from {g.user.username}"
|
||||||
os.system(f"git commit -m '{commit_message}'") # noqa: S605
|
os.system(f"git commit -m '{commit_message}'") # noqa: S605
|
||||||
os.system("git push")
|
os.system("git push")
|
||||||
print("publish")
|
|
||||||
|
# build url for github page to open PR
|
||||||
|
output = os.popen("git remote -v").read()
|
||||||
|
remote_url = output.strip().split("\n")[0].split("\t")[1].split(" ")[0].replace(".git", "")
|
||||||
|
pr_url = f"{remote_url}/compare/{publish_branch}?expand=1"
|
||||||
|
|
||||||
|
# try to clean up
|
||||||
|
os.chdir("/tmp")
|
||||||
|
if os.path.exists(destination_process_root):
|
||||||
|
shutil.rmtree(destination_process_root)
|
||||||
|
|
||||||
|
return pr_url
|
||||||
|
|
Loading…
Reference in New Issue