Skip to content

Add Owner to EditChange struct for repository transfer webhook event payloads #2749

@ecrupper

Description

@ecrupper

When a repository has a transfer of ownership, it will send a repository event webhook. The structure ends up looking like this:

{
  "action": "transferred",
  "changes": {
    "owner": {
      "from": {
        "user": {
          "login": "octocat",
          ... etc

OR

{
  "action": "transferred",
  "changes": {
    "owner": {
      "from": {
        "organization": {
          "login": "github",
          ... etc

I'd like to add the missing Owner field to the EditChange struct. I was thinking it would look something like this:

type EditChange struct {
	Title *EditTitle `json:"title,omitempty"`
	Body  *EditBody  `json:"body,omitempty"`
	Base  *EditBase  `json:"base,omitempty"`
	Repo  *EditRepo  `json:"repository,omitempty"`
	Owner *EditOwner `json:"owner,omitempty"`
}

type EditOwner struct {
	OwnerInfo *OwnerInfo `json:"from,omitempty"`
}

type OwnerInfo struct {
	Actor *User `json:"user,omitempty"`
	Org   *User `json:"organization,omitempty"`
}

Unfortunately, due to the structure of the payload, OwnerInfo will have to account for those two different options, even though they both refer to owners.

Metadata

Metadata

Assignees

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