Fix github docs for pull_request_review.state

The schema validation for these values is correct (if a little
generous) but the docs had some incorrect example values.  Update
them to match the schema.

Also, add comments to the schema validation indicating the source
of these somewhat mysterious values.

Change-Id: Idf26848a8c121d311590d07e003b53b8e867affd
This commit is contained in:
James E. Blair 2024-03-14 08:00:32 -07:00
parent 4680c58a27
commit 91e22dfa96
2 changed files with 13 additions and 2 deletions

View File

@ -412,8 +412,8 @@ the following options.
This is only used for ``pull_request_review`` events. It
accepts a list of strings each of which is matched to the review
state, which can be one of ``approved``, ``comment``, or
``request_changes``.
state, which can be one of ``approved``, ``comment``,
``changes_requested``, ``dismissed``, or ``pending``.
.. attr:: status

View File

@ -181,6 +181,17 @@ def getNewSchema():
'branch': scalar_or_list(vs.Any(ZUUL_REGEX, str)),
})
# The docs for this are at:
# https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=dismissed#pull_request_review
# They specify "dismissed, approved, changes_requested"
# But we have also experimentally seen "commented"
# The graphql docs are at:
# https://docs.github.com/en/enterprise-server@3.12/graphql/reference/enums#pullrequestreviewstate
# And they additionally specify "commented" and "pending".
# It's unclear whether "pending" can show up in the webhook (it
# may only appear in a graphql query of a user's own unsaved
# reviews) but since we've seen the extra "commented" value, let's
# be generous and accept "pending" as well.
pull_request_review_schema = pull_request_review_base_schema.extend({
'action': scalar_or_list(vs.Any('submitted', 'dismissed')),
'state': scalar_or_list(vs.Any(