mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:17:35 +00:00
Meta: Use author username for pull request IRC notifications
Just 'github.actor' may or may not be the actual PR author, but especially since action runs have to be approved for first-time contributors, it's been giving us a lot of incorrect results.
This commit is contained in:
parent
488ee56cf7
commit
4d697855ea
1 changed files with 7 additions and 3 deletions
|
@ -55,6 +55,10 @@ def compute_lines(wrapper):
|
||||||
elif 'pull_request' in event:
|
elif 'pull_request' in event:
|
||||||
# This is a PR.
|
# This is a PR.
|
||||||
raw_action = event['action']
|
raw_action = event['action']
|
||||||
|
pull_request = event['pull_request']
|
||||||
|
# actor, until here, is whoever caused the action to run -
|
||||||
|
# if it's a PR we want the author's name in the notification.
|
||||||
|
actor = pull_request['user']['login']
|
||||||
if raw_action == 'opened':
|
if raw_action == 'opened':
|
||||||
action = 'opened'
|
action = 'opened'
|
||||||
elif raw_action == 'reopened':
|
elif raw_action == 'reopened':
|
||||||
|
@ -65,7 +69,7 @@ def compute_lines(wrapper):
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
action = '{}(?)'.format(raw_action)
|
action = '{}(?)'.format(raw_action)
|
||||||
if event['pull_request'].get('draft', True):
|
if pull_request.get('draft', True):
|
||||||
print("This is a draft PR, so IRC won't be notified.")
|
print("This is a draft PR, so IRC won't be notified.")
|
||||||
print('Note: No rebuild occurs when the PR is "un-drafted"!')
|
print('Note: No rebuild occurs when the PR is "un-drafted"!')
|
||||||
return False
|
return False
|
||||||
|
@ -74,8 +78,8 @@ def compute_lines(wrapper):
|
||||||
action=action,
|
action=action,
|
||||||
status=status,
|
status=status,
|
||||||
run_id=run_id,
|
run_id=run_id,
|
||||||
title=event['pull_request'].get('title', '???'),
|
title=pull_request.get('title', '???'),
|
||||||
link=event['pull_request'].get('_links', dict()).get('html', dict()).get('href', '???'),
|
link=pull_request.get('_links', {}).get('html', {}).get('href', '???'),
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
print('Unrecognized event type?!')
|
print('Unrecognized event type?!')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue