Is there a way to check if an integration is installed on a repository without fetching the entire list


#1

We have a page for our integration that lists some getting-started steps. We would like to display on the page whether or not the integration has been installed on the repository they’re trying to work on. This is useful because many of our users are members of a large org that hasn’t necessarily installed the integration on their repository and they’re not admins of the org, so they can’t go check themselves. We have discussed the following options:

  1. Maintain a table ourselves of org/repo -> installationId mappings that we update when install events are fired. This will also involve some sort of batch that syncs the table from time to time, since webhooks will end up getting dropped, etc.
  2. Attempt to perform an action only an installed integration could perform and catch the error – replying that the integration is not installed on the repository if so.

Is there a more straightforward way of doing this? Perhaps an api endpoint that returns true or false about whether your integration is installed?

I guess this was just a long way of asking if there is a org/repo -> installationId endpoint and if not, can one be created?


#2

Currently, we have the GET /installation/repositories endpoint available (Doc). Are you looking for something different or more granular than this, @imbstack?


#3

I guess the only issue here is that we have to manually maintain a list of installationId’s in order to call that endpoint. That’s the option we’ve gone with for now.

A more succinct version of what I was asking is that it seems like this action should be in the first workflow listed in https://developer.github.com/early-access/integrations/authentication/#authentication and not the second. Afaict it is more metadata of what my integration has access to, rather than something I want to do to a particular install of the integration. Does that make sense?

In either case, what we’ve built at the moment works and if that’s the correct way to do things, that’s fine. I just like to avoid maintaining a copy of state that github already has if possible.