Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formatting: handle 'converted_to_draft' PR event #77

Merged
merged 1 commit into from
Oct 25, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion sopel_modules/github/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,8 @@ def fmt_pull_request_summary_message(payload=None):
action = 'drafted'
elif action == 'ready_for_review':
action = 'readied'
elif action == 'converted_to_draft':
action = 'un-readied'

return '[{}] {} {} pull request #{}: {} ({}...{})'.format(
fmt_repo(payload['repository']['name']),
Expand Down Expand Up @@ -518,7 +520,7 @@ def get_formatted_response(payload, row):
elif payload['event'] == 'commit_comment':
messages.append(fmt_commit_comment_summary() + " " + fmt_url(shorten_url(payload['comment']['html_url'])))
elif payload['event'] == 'pull_request':
if re.match('((re)?open|clos)ed', payload['action']) or payload['action'] == 'ready_for_review':
if re.match('((re)?open|clos)ed', payload['action']) or payload['action'] in ['ready_for_review', 'converted_to_draft']:
messages.append(fmt_pull_request_summary_message() + " " + fmt_url(shorten_url(payload['pull_request']['html_url'])))
elif payload['action'] == 'edited':
if 'changes' in payload:
Expand Down