Skip to content

Commit

Permalink
Command parser: allow @bors:
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bryanburgers committed Jun 14, 2019
1 parent dc435f6 commit 69f5fd1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions homu/parse_issue_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 16 additions & 0 deletions homu/tests/test_parse_issue_comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit 69f5fd1

Please sign in to comment.