sub out git protocol from the uri for https when publishing w/ burnettk

This commit is contained in:
jasquat 2023-04-11 16:27:54 -04:00
parent 082a6434cf
commit 7ccbc86c48
No known key found for this signature in database
1 changed files with 7 additions and 0 deletions

View File

@ -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"