Merge "Remove translation of check run action in github driver"

This commit is contained in:
Zuul 2021-05-11 22:53:48 +00:00 committed by Gerrit Code Review
commit f4fd542398
4 changed files with 21 additions and 3 deletions

View File

@ -19,6 +19,8 @@
# When using the checks API to report results, failed runs
# will have a "re-run" button which emits this event.
- event: check_run
action: rerequested
check: .*/check:.*
start:
github:
check: 'in_progress'

View File

@ -0,0 +1,8 @@
---
deprecations:
- |
Zuul now correctly handles the ``rerequested`` action on check run trigger
definitions (:value:`pipeline.trigger.<github source>.event.check_run`)
literally. This has been ``requested`` which doesn't match the GitHub api.
The value ``requested`` is now deprecated and will be removed in a later
release.

View File

@ -575,9 +575,6 @@ class GithubEventProcessor(object):
event = self._pull_request_to_event(pr_body)
event.type = "check_run"
# Simplify rerequested action to requested
if action == "rerequested":
action = "requested"
event.action = action
check_run_tuple = "%s:%s:%s" % _check_as_tuple(check_run)

View File

@ -23,6 +23,17 @@ class GithubTrigger(BaseTrigger):
name = 'github'
log = logging.getLogger("zuul.trigger.GithubTrigger")
def __init__(self, driver, connection, config=None):
# This is a compatibility layer to map the action 'requested' back
# to the original action 'rerequested'.
# TODO: Remove after zuul 5.0
for item in config:
if item.get('action') == 'requested':
item['action'] = 'rerequested'
super().__init__(driver, connection, config=config)
def getEventFilters(self, connection_name, trigger_config):
efilters = []
for trigger in to_list(trigger_config):