Allow rerequested action for Github triggers

The 'requested' action is deprecated in favor of 'rerequested', but the
new schema did not permit the new action name.

Change-Id: I047d2676f44151e7569d38bc1df3d26ffee83202
This commit is contained in:
Simon Westphahl 2024-03-14 13:20:01 +01:00
parent 382e9d386c
commit 4680c58a27
No known key found for this signature in database
3 changed files with 11 additions and 3 deletions

View File

@ -20,6 +20,9 @@
- event: pull_request
action: unlabeled
label: barfoo
# Valid
- event: check_run
action: rerequested
# "extra keys not allowed @ data['check']"
- event: pull_request
action:

View File

@ -2799,7 +2799,7 @@ class TestGithubSchemaWarnings(ZuulTestCase):
def test_broken_config_on_startup_warnings(self):
tenant = self.scheds.first.sched.abide.tenants.get('tenant-one')
self.assertEquals(
len(tenant.layout.loading_errors), 8,
len(tenant.layout.loading_errors), 9,
"An error should have been stored")
self.assertIn(
"extra keys not allowed @ data['check']",
@ -2823,5 +2823,8 @@ class TestGithubSchemaWarnings(ZuulTestCase):
"extra keys not allowed @ data['unlabel']",
str(tenant.layout.loading_errors[6].error))
self.assertIn(
"Use 'rerequested' instead",
"expected a list for dictionary value @ data['action']",
str(tenant.layout.loading_errors[7].error))
self.assertIn(
"Use 'rerequested' instead",
str(tenant.layout.loading_errors[8].error))

View File

@ -197,7 +197,9 @@ def getNewSchema():
# Check run
check_run_schema = base_schema.extend({
vs.Required('event'): 'check_run',
'action': scalar_or_list(vs.Any('requested', 'completed')),
# The 'requested' action is deprecated, but we have a separate,
# more specific deprecation for this.
'action': scalar_or_list(vs.Any('rerequested', 'completed')),
'check': scalar_or_list(str),
})