diff --git a/scripts/send_to_bot.py b/scripts/send_to_bot.py index 00f7ba5f4..81d876dcb 100644 --- a/scripts/send_to_bot.py +++ b/scripts/send_to_bot.py @@ -30,10 +30,10 @@ double-check the commits. ################################################################################ def post_comment(pr_id, body, once): + endpoint = BOT_URL + '/comment' + if once: - endpoint = BOT_URL + '/comment/once' - else: - endpoint = BOT_URL + '/comment' + endpoint += '/once' headers = {'Content-Type': 'application/json'} data = json.dumps({'pr_id': pr_id, 'body': body}) @@ -54,16 +54,16 @@ def post_comment(pr_id, body, once): return True def main(action): - if action not in ('error', 'check'): + if action not in ('report-errors', 'report-check-results'): print('Unknown action:', action, file=sys.stderr) sys.exit(1) content = sys.stdin.read().strip() - if action == 'error': + if action == 'report-errors': comment_body = COMMENT_ERROR.format(build_id=BUILD_ID, content=content) comment_once = False - elif action == 'check': + elif action == 'report-check-results': comment_body = COMMENT_CHECK.format(content=content) comment_once = True diff --git a/scripts/test.sh b/scripts/test.sh index 506afaa4c..e7dd74550 100644 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -22,7 +22,7 @@ function pr_test { if [ -n "$errs" ]; then echo -e "Test failed!\n$errs\n" >&2 echo 'Sending errors to tldr-bot.' >&2 - echo -n "$errs" | python3 scripts/send_to_bot.py error + echo -n "$errs" | python3 scripts/send_to_bot.py report-errors exit 1 fi } @@ -35,7 +35,7 @@ function pr_check { if [ -n "$msgs" ]; then echo -e "\nCheck PR reported the following message(s):\n$msgs\n" >&2 echo 'Sending check results to tldr-bot.' >&2 - echo -n "$msgs" | python3 scripts/send_to_bot.py check + echo -n "$msgs" | python3 scripts/send_to_bot.py report-check-results fi }