Skip to content

Webhook review.type values differ from the docs #39450

Description

@HardMax71

Gitea Version

main (ea91028); the docs page is the current one on docs.gitea.com.

What happened?

For the pull_request_review_approved, pull_request_review_rejected and pull_request_review_comment webhooks, the docs say review.type is approved, rejected or comment (docs/usage/repository/webhooks.md in gitea/docs), and the ReviewPayload.Type comment in modules/structs/hook.go says the same.

The payload carries the full event name instead. PullRequestReview in services/webhook/notifier.go sets Type: string(reviewHookType), and reviewHookType is one of the HookEventPullRequestReview* constants, so an approval arrives as "type": "pull_request_review_approved". The Actions notifier in services/actions/notifier.go does the same.

A consumer that follows the docs and matches on approved never matches. Integrations that exist today already read the full names, so bringing the docs in line with the payload looks safer than changing the payload. The docs page and the struct comment both need the change.

How are you running Gitea?

Read from the source on main; it doesn't depend on the install.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions