Skip to content

GHUser even when event comes from Organization type #1497

Open
@Jalmeida1994

Description

@Jalmeida1994

Describe the bug
A GHUser type is returned even when in the payload the account type is Organization.

More precisely in the event installation.created when the installation.account.type is set to Organization (app installed in organization) the installation.account in the @Installation.Created payload returns a GHUser.

{
  "action": "created",
  "installation": {
    "id": 12345,
    "account": {
      "login": "org-name",
      <...>
      "type": "Organization",
      "site_admin": false
    },
<...>
fun onInstall(@Installation.Created installationPayload: GHEventPayload.Installation) {
  val tenantGHOrganization = installationPayload.installation.account // <-- GHUser instance
}

Also tried to use the installationPayload.organization object but it always returned null (probably it's used in other events):

fun onInstall(@Installation.Created installationPayload: GHEventPayload.Installation) {
  LOG.info("org: " + installationPayload.organization.name) // <--  Cannot invoke "org.kohsuke.github.GHOrganization.getName()" because the return value of "org.kohsuke.github.GHEventPayload$Installation.getOrganization()" is null
}

To Reproduce
Steps to reproduce the behavior:

  1. Create an event with installation.created in an organization (install app in an organization)
  2. Catch the event
  3. Retrieve the installationPayload.installation.account object
  4. Or retrieve the installationPayload.organization object

Expected behavior
If the payload has the installation.account.type set to Organization the installationPayload.installation.accountshould return a GHOrganization object or the installationPayload.organization should not return null.

Desktop (please complete the following information):

  • OS: macOS Monterey v12.4 (Apple M1)

Additional context
Using Kotlin and Quarkus GitHub App

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions