Correction of GH pulls url regex

This commit is contained in:
Hein-Pieter van Braam-Stewart
2021-01-27 17:45:57 +01:00
parent 7de94e2e1e
commit f556214d4e
2 changed files with 4 additions and 4 deletions

2
bot.py
View File

@@ -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(' '):

View File

@@ -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 = []