aboutsummaryrefslogtreecommitdiff
path: root/modules/github/__init__.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-05-17 10:10:27 +0100
committerGravatar jesopo2019-05-17 10:10:27 +0100
commit3411f12fc49288187166191c0fe1c66f70955d34 (patch)
tree6d6a743c86a80c173f37385a1e8584c0ce89aede /modules/github/__init__.py
parent`server` -> `event["server"]` (diff)
signature
Use github-default-repo to fill in org when org is missing but repo isn't
Diffstat (limited to 'modules/github/__init__.py')
-rw-r--r--modules/github/__init__.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/modules/github/__init__.py b/modules/github/__init__.py
index 670d1ab7..a492afa9 100644
--- a/modules/github/__init__.py
+++ b/modules/github/__init__.py
@@ -110,18 +110,19 @@ CHECK_RUN_FAILURES = ["failure", "cancelled", "timed_out", "action_required"]
class Module(ModuleManager.BaseModule):
def _parse_ref(self, channel, ref):
repo, _, number = ref.rpartition("#")
- if not repo:
- repo = channel.get_setting("github-default-repo", None)
+ org, _, repo = repo.partition("/")
- username, repository = None, None
- if repo:
- username, _, repository = repo.partition("/")
+ default_repo = channel.get_setting("github-default-repo", "")
+ default_org, _, default_repo = default_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")
if not number.isdigit():
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):
repo = utils.irc.color("%s/%s" % (username, repository), COLOR_REPO)