How do I find out on which repository the integration is being installed?


#1

I’m probably missing something, but, given the following event payload received upon installation:

{
  "action": "created",
  "installation": {
    "id": [INSTALLATION_ID],
    "account": {
      "login": "tobie",
      "id": 3392,
       // etc...

    },
    "access_tokens_url": "https://api.github.com/installations/[INSTALLATION_ID]/access_tokens",
    "repositories_url": "https://api.github.com/installation/repositories",
    "html_url": "https://github.com/settings/installations/[INSTALLATION_ID]"
  },
  "sender": {
    "login": "tobie",
    "id": 3392,
    // etc...
  }
}

I can’t seem to find a more straightforward way to find out on which repositories an installation has been installed than:

GET /installation/repositories?user_id={{ installation.account.id }}

If the owner installs the same integration on some of their other repositories in the future, then I don’t think there’s any way to find out which of the repositories returned by this API are the new ones and which were installed previously.

I think it would help tremendously if you provided the name/id of repositories upon installation as part of the above payload. Similarly created a new installation updated event every time a repository is added or removed.

I need to run an initial script on each open pull request the first time the integration is installed on a repository, and right now, I have no idea how to reliably do that.

Thanks for your time.

–tobie


#2

Partially answering my own question here, there seems to be an IntegrationInstallationEvent which popped up in my logs today.