First GitHub deploy via API (and no GitHub Netlify App yet) and auto publishing not working

Hi

this is my first post and I would like to say hello to every community member.

I am building a service that automatically deploys a GitHup repo to user’s Netlify account (making a POST request to https://api.netlify.com/api/v1/sites/). However, if user has just started using Netlify (and done no manual GitHub deployment yet), there is no GitHub Netlify App installation_id to provide (because user has never installed it).

Unfortunately, providing no installation_id value causes no automatic deploys on repo commit, despite a status of “Auto publishing is on. Deploys from master are published automatically”

Is there a way to either:
a) force GitHub Netlify App install for user, who has not installed it, or
b) provide a workaround for enforcing auto publishing?

Many thanks
Janos

Hey @JanosBongiorno,
Welcome to the forum :slight_smile:

Unfortunately, there’s not (and technically can’t be) a way to force install the Netlify app on someone else’s Github account. You’ll have to have users of your service install the app on their own Github accounts in order to get auto publishing on commit. You also couldn’t make up a fake installation_id for the first deploy; not having an installation_id is just a sign that no communication is possible between Github and Netlify. The only way to get git commits from Github to Netlify without having authorization between them is to pull down the files from the repo and make POST requests of those same files to Netlify as you described.

Could you have a shared Github account that your users have access to, and install the Netlify app on that Github account?

Hi @jen - that’s a good solution indeed - thank you for your support!

I create a separate repository under my GitHub account for each client and add client as a collaborator for full code access (as described here: Collaborators - GitHub Docs).

Later I deploy this repository to client’s Netlify account and auto-publishing works just fine :+1:

Then I also deploy another app, hosted on the same GitHub, so the client can USE this app on their Netlify account, but have no access to my code (GitHub repository) instead.

Have a great day!

1 Like