Skip to content

Commit

Permalink
added helper function is_valid_gh_repo; match exact repo name
Browse files Browse the repository at this point in the history
  • Loading branch information
smuzaffar committed Feb 1, 2018
1 parent 5cb90a2 commit ad18421
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion github_hooks_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,17 @@
REPO_HOOK_MAP.append(["cms-data/.+", ["Jenkins_Github_Hook","Jenkins_Github_Hook_Push"]])
REPO_HOOK_MAP.append(["cms-externals/.+", ["Jenkins_Github_Hook","Jenkins_Github_Hook_Push"]])

def is_valid_gh_repo(repo_name):
import re
for r in REPO_HOOK_MAP:
if re.match("^"+r[0]+"$",repo_name): return True
return False

def get_repository_hooks(repo_name, hook=""):
import re
hooks = {}
for r in REPO_HOOK_MAP:
if re.match(r[0],repo_name):
if re.match("^"+r[0]+"$",repo_name):
if not hook:
for h in r[1]: hooks[h]=GITHUB_HOOKS[h]
elif hook in r[1]:
Expand Down

0 comments on commit ad18421

Please sign in to comment.