Skip to content

Commit

Permalink
Allow git protocol url in git/config
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterC-DLS committed Jan 28, 2020
1 parent ea90f86 commit d2646cc
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions utils/create_release_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ def findGitConfigFile():
logger.error(msg)
raise ValueError(msg)

def parse_git_url(url):
"""
return (organization, repository) tuple from url line of .git/config file
"""
if url.startswith("git@"): # deal with git@github.com:org/repo.git
url = url.split(":")[1]
org, repo = url.rstrip(".git").split("/")[-2:]
return org, repo

def getRepositoryInfo():
"""
Expand All @@ -70,9 +78,7 @@ def getRepositoryInfo():
msg = "Not a GitHub repo: " + url
logger.error(msg)
raise ValueError(msg)
org, repo = url.rstrip(".git").split("/")[-2:]
return org, repo

return parse_git_url(url)

def get_release_info(token, base_tag_name, head_branch_name, milestone_name):
"""mine the Github API for information about this release"""
Expand Down

0 comments on commit d2646cc

Please sign in to comment.