Skip to content

Commit 7b3b9fb

Browse files
committed
regex search for repo NO_JIRA
1 parent 35ef0e5 commit 7b3b9fb

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

main/githooks.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ def get_repo():
152152
if _is_github_event():
153153
return os.environ['GITHUB_REPOSITORY']
154154
else:
155-
return _get_output(['git', 'config', '--get', 'remote.origin.url']).strip().split(':')[-1].rstrip('.git')
155+
url = _get_output(['git', 'config', '--get', 'remote.origin.url'])
156+
org = re.search(r'github\.com[:\/](.+?)(\.git)?$', url)
157+
return org.group(1) if org else url
156158

157159
def get_event():
158160
'''Get the git event'''
@@ -939,9 +941,9 @@ def commit_hook(merge=False):
939941
def commit_msg_hook():
940942
retval = 0
941943
files = get_commit_files()
942-
commit_message = Path(""" sys """.argv[1]).read_text()
944+
commit_message = Path(sys.argv[1]).read_text()
943945

944946
print(' Check commit message ...')
945947
retval += check_commit_msg(commit_message, files['M'] + files['A'], get_repo())
946948

947-
return retval
949+
return retval

0 commit comments

Comments
 (0)