Skip to content

hooks: report the pull-request author in the lifecycle payload #554

Description

@piekstra

Lifecycle hook payloads identify the PR only by URL, so a notifier that wants to address the person whose PR was reviewed has to re-fetch the PR from the host on every verdict — an extra API call per run, in a path that is supposed to cost nothing and never fail the review.

cr already holds the answer: gitprovider.PR.Author is read on every run, for every provider, before planning.

Proposal

Add author to the hook payload — the PR author's git-host login (GitHub login / GitLab username) — and expose it as CR_AUTHOR alongside the other common fields.

Semantics: the field is populated once cr has read the pull request, which is every event except run.started. It is omitted (empty) when the run fails before the PR read. No extra provider calls: the value is observed from the PR snapshot the run already fetches.

Non-goals

  • No display name, email, or avatar — one stable, host-native identifier is what a consumer needs to key a mapping on, and the rest invites drift.
  • No chat-handle mapping in cr. Translating a git-host login to a Slack/Teams member ID is the consumer's job; cr reporting the login is what makes that mapping possible without a per-run API call.

Consumer

A Slack notify hook that posts review verdicts to a channel wants to @mention the author on request_changes. Today it would need gh pr view --json author per verdict; with author in the payload it can look up a locally cached login -> member-ID map and post the mention with no network call at all.

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