Search code examples
probot

Is it possible to perform an action with `context` on the init of the app?


I'm simply looking for something like this

app.on('init', async context => {
 ...
})

Basically I just need to make to calls to the github API, but I'm not sure there is a way to do it without using the API client inside the Context object.


Solution

  • I ended up using probot-scheduler

    const createScheduler = require('probot-scheduler')
    module.exports = app => {
    
      createScheduler(app, {
        delay: false
      })
      robot.on('schedule.repository', context => {
        // this is called on startup and can access context
      })
    }