Description
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:
- Create an event with
installation.created
in an organization (install app in an organization) - Catch the event
- Retrieve the
installationPayload.installation.account
object - Or retrieve the
installationPayload.organization
object
Expected behavior
If the payload has the installation.account.type
set to Organization
the installationPayload.installation.account
should 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