mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-03-28 21:16:20 +01:00
Send to bot: better action names, simplify endpoint
This commit is contained in:
parent
6af2c9b9b3
commit
134e63f318
2 changed files with 8 additions and 8 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue