Background: I have a project deployed to heroku. The heroku app is connected with github so I can press the "deploy" button from heroku's web api to manually deploy a branch on github to heroku.
What I'm trying to do is build a slack bot that will let me accomplish that via a slack command. Ideally, there'd be some function on heroku's platform api like .deploy('my_app', 'some_branch_on_github)
, but I can't seem to find it.
The platform api's build feature is close. That function lets you provide the public url of a tarball that heroku will then deploy. However, my github repo isn't public, so that doesn't work. A private repo shouldn't be a problem, though, since heroku's already connected to my github repo.
TLDR: How can I programmatically tell Heroku to deploy my app from a private github it's connected to?
When you enable automatic deploys for a GitHub branch, Heroku builds and deploys all pushes to that branch. If, for example, you have a development app on Heroku, you can configure pushes to your GitHub development branch to be automatically built and deployed to that app.
With manual deploys, you can create an immediate deployment of any branch from the GitHub repo that’s connected to your app. Use manual deploys if you want to control when changes are deployed to Heroku. You can also use manual deploys to temporarily deploy a branch other than the one that’s configured for automatic deployment.
Open the Settings tab and locate Buildpacks and click “Add buildpack”. Select nodejs from the options and click Save changes. Now, go back to the Deploy tab, and click Deploy Branch at the bottom. Heroku will take the code and host it. Open the Activity tab and there you can see the progress:
From Heroku, click in your avatar image / Account settings. Go to API Key, click in reveal. Copy the API Key, we are going to use it in the next section. 3. Create a repository in GitHub and implement CI/CD workflow Go to your GitHub account, create a repository and push the project. Then, click on the Settings tab.
I got a response from Heroku's support team asking pretty much the same question. Their answer was that what I'm trying to do is not possible, but will be at some point (although not in the next few months, anyway).
They suggested that I could just use the undocumented web api used by heroku's own web console (a POST to an endpoint on kolkrabbi.heroku.com
). They did warn that, as a private api, that's likely to change without warning.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With