From 69f5fd185b172f323f92d694dfb883de960df42d Mon Sep 17 00:00:00 2001 From: Bryan Burgers Date: Fri, 14 Jun 2019 06:35:06 -0500 Subject: [PATCH] Command parser: allow `@bors:` Commands that started with the botname *and then a colon* were being dropped, because the parser didn't recognize the command and didn't continue. Fix this by explicitely allowing a colon after the botname. --- homu/parse_issue_comment.py | 3 +++ homu/tests/test_parse_issue_comment.py | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/homu/parse_issue_comment.py b/homu/parse_issue_comment.py index e43133f..8d53bc0 100644 --- a/homu/parse_issue_comment.py +++ b/homu/parse_issue_comment.py @@ -174,6 +174,9 @@ def parse_issue_comment(username, body, sha, botname, hooks=[]): if word == '@' + botname: continue + if word == '@' + botname + ':': + continue + if word == 'r+' or word.startswith('r='): approved_sha = sha diff --git a/homu/tests/test_parse_issue_comment.py b/homu/tests/test_parse_issue_comment.py index e7e475a..e7da8ef 100644 --- a/homu/tests/test_parse_issue_comment.py +++ b/homu/tests/test_parse_issue_comment.py @@ -21,6 +21,22 @@ def test_r_plus(): assert command.actor == 'jack' +def test_r_plus_with_colon(): + """ + @bors: r+ + """ + + author = "jack" + body = "@bors: r+" + commands = parse_issue_comment(author, body, commit, "bors") + + assert len(commands) == 1 + command = commands[0] + assert command.action == 'approve' + assert command.actor == 'jack' + assert command.commit == commit + + def test_r_plus_with_sha(): """ @bors r+ {sha}