Use github-default-repo to fill in org when org is missing but repo isn't
This commit is contained in:
parent
3bbc4b3b77
commit
3411f12fc4
1 changed files with 8 additions and 7 deletions
|
@ -110,18 +110,19 @@ CHECK_RUN_FAILURES = ["failure", "cancelled", "timed_out", "action_required"]
|
||||||
class Module(ModuleManager.BaseModule):
|
class Module(ModuleManager.BaseModule):
|
||||||
def _parse_ref(self, channel, ref):
|
def _parse_ref(self, channel, ref):
|
||||||
repo, _, number = ref.rpartition("#")
|
repo, _, number = ref.rpartition("#")
|
||||||
if not repo:
|
org, _, repo = repo.partition("/")
|
||||||
repo = channel.get_setting("github-default-repo", None)
|
|
||||||
|
|
||||||
username, repository = None, None
|
default_repo = channel.get_setting("github-default-repo", "")
|
||||||
if repo:
|
default_org, _, default_repo = default_repo.partition("/")
|
||||||
username, _, repository = repo.partition("/")
|
|
||||||
|
|
||||||
if not username or not repository or not number:
|
org = org or default_org
|
||||||
|
repo = repo or default_repo
|
||||||
|
|
||||||
|
if not org or not repo or not number:
|
||||||
raise utils.EventError("Please provide username/repo#number")
|
raise utils.EventError("Please provide username/repo#number")
|
||||||
if not number.isdigit():
|
if not number.isdigit():
|
||||||
raise utils.EventError("Issue number must be a number")
|
raise utils.EventError("Issue number must be a number")
|
||||||
return username, repository, number
|
return org, repo, number
|
||||||
|
|
||||||
def _parse_issue(self, page, username, repository, number):
|
def _parse_issue(self, page, username, repository, number):
|
||||||
repo = utils.irc.color("%s/%s" % (username, repository), COLOR_REPO)
|
repo = utils.irc.color("%s/%s" % (username, repository), COLOR_REPO)
|
||||||
|
|
Loading…
Reference in a new issue