How can I run Heroku CLI commands from the Heroku Scheduler, one off dynos or worker dynos?
The CLI can be installed with the CLI buildpack or by using the following command as the first step in your scheduler script
~ $ curl -s https://cli-assets.heroku.com/heroku-linux-x64.tar.gz | tar xz
You'll need to set a valid API key on your application to run any application specific commands. You can generate a key by using
heroku authorizations:create on a machine that is currently running an authenticated version of the Heroku CLI. You can then set a configuration variable on your application that will make this API key available when needed by the CLI. The configuration variable should be named
HEROKU_API_KEY and can be set by running
heroku config:set HEROKU_API_KEY=(API_KEY_HERE) -a my-app.