diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/api.yml b/spiffworkflow-backend/src/spiffworkflow_backend/api.yml index ea3e6998e..3dc700612 100755 --- a/spiffworkflow-backend/src/spiffworkflow_backend/api.yml +++ b/spiffworkflow-backend/src/spiffworkflow_backend/api.yml @@ -470,7 +470,7 @@ paths: content: application/json: schema: - $ref: "#/components/schemas/OkTrue" + type: string /processes: get: diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py index cdd2ec30f..e5fde2033 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -377,8 +377,9 @@ def process_model_publish( if branch_to_update is None: branch_to_update = current_app.config["GIT_MERGE_BRANCH"] process_model_identifier = un_modify_modified_process_model_id(modified_process_model_identifier) - GitService().publish(process_model_identifier, branch_to_update) - return Response(json.dumps({"ok": True}), status=200, mimetype="application/json") + pr_url = GitService().publish(process_model_identifier, branch_to_update) + data = {"ok": True, "pr_url": pr_url} + return Response(json.dumps(data), status=200, mimetype="application/json") def process_model_list( diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/git_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/git_service.py index 0c24e965d..b5c451b45 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/git_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/git_service.py @@ -94,4 +94,15 @@ class GitService: 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("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