From f556214d4e6025d431fd5c2f0f0632590f0d37a4 Mon Sep 17 00:00:00 2001 From: Hein-Pieter van Braam-Stewart Date: Wed, 27 Jan 2021 17:45:57 +0100 Subject: [PATCH] Correction of GH pulls url regex --- bot.py | 2 +- test-regex.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bot.py b/bot.py index f5dd7bd..ed2fd93 100755 --- a/bot.py +++ b/bot.py @@ -21,7 +21,7 @@ DEFAULT_REPOSITORY=os.environ.get('DEFAULT_REPOSITORY') REPOSITORY_SHORTNAME_MAP=os.environ.get('REPOSITORY_SHORTNAME_MAP') RE_TAG_PROG = re.compile('([A-Za-z0-9_.-]+)?#(\d+)') -RE_URL_PROG = re.compile('github.com/([A-Za-z0-9_.-]+)/([A-Za-z0-9_.-]+)/(issues|pulls)/(\d+)\S*') +RE_URL_PROG = re.compile('github.com/([A-Za-z0-9_.-]+)/([A-Za-z0-9_.-]+)/(issues|pull)/(\d+)\S*') SHORTNAME_MAP={} for item in re.sub('\s+', ' ', REPOSITORY_SHORTNAME_MAP).split(' '): diff --git a/test-regex.py b/test-regex.py index d3d6f48..0fc53a7 100644 --- a/test-regex.py +++ b/test-regex.py @@ -27,8 +27,8 @@ tests = [ { 'text': '(repo#100) text', 'results' : [ makeurl(100, 'repo') ] }, { 'text': 'https://github.com/godotengine/issue-bot/issues/2', 'results': [ makeurl(2, 'issue-bot') ] }, - { 'text': 'https://github.com/godotengine/godot/pulls/100', 'results': [ makeurl(100) ] }, - { 'text': 'https://github.com/godotengine/godot/pulls/100#issuecomment-1', 'results': [ makeurl(100) ] }, + { 'text': 'https://github.com/godotengine/godot/pull/100', 'results': [ makeurl(100) ] }, + { 'text': 'https://github.com/godotengine/godot/pull/100#issuecomment-1', 'results': [ makeurl(100) ] }, { 'text': 'a long line of text with an url https://github.com/godotengine/godot/issues/100 and some tags #102 repo#103', 'results': [ makeurl(102), makeurl(103, 'repo'), makeurl(100) ] }, @@ -37,7 +37,7 @@ tests = [ ] tag_prog = re.compile('([A-Za-z0-9_.-]+)?#(\d+)') -url_prog = re.compile('github.com/([A-Za-z0-9_.-]+)/([A-Za-z0-9_.-]+)/(issues|pulls)/(\d+)\S*') +url_prog = re.compile('github.com/([A-Za-z0-9_.-]+)/([A-Za-z0-9_.-]+)/(issues|pull)/(\d+)\S*') for test in tests: text = test['text'] result = []