From 4707a030d746af9909343c080dce99a355d7544d Mon Sep 17 00:00:00 2001 From: jasquat Date: Tue, 11 Apr 2023 16:27:54 -0400 Subject: [PATCH] sub out git protocol from the uri for https when publishing w/ burnettk --- .../src/spiffworkflow_backend/services/git_service.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/git_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/git_service.py index a2c7d216e..48db5a2d7 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/git_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/git_service.py @@ -1,5 +1,6 @@ """Git_service.""" import os +import re import shutil import subprocess # noqa we need the subprocess module to safely run the git commands import uuid @@ -253,6 +254,12 @@ class GitService: # build url for github page to open PR git_remote = cls.run_shell_command_to_get_stdout(["git", "config", "--get", "remote.origin.url"]) + git_remote = re.sub( + pattern=r'^git@([^:]+):', + repl='https://\\1/', + string=git_remote + ) + remote_url = git_remote.strip().replace(".git", "") pr_url = f"{remote_url}/compare/{branch_to_update}...{branch_to_pull_request}?expand=1"