question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enable/disable external probots from each repository

See original GitHub issue

In my organization we have a probot that uses some other external probots. The probot is enabled at the organization level so that all repositories can use it.

The problem with such setup is that repositories cannot enable/disable an specific probot unless the probot has support for that. I’m wondering if that’s something probot could support. The idea that I had in mind was that repositories could contain a settings file such as:

# .github/probots.yml
- autolabeler
- triager

Where they could specify the probots that they want to enable.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pepicrftcommented, May 7, 2018

Awesome! I’m currently implementing it but it seems like it’s going to work. I’ll join your Slack channel 😃. Thank you very much for all your help.

1reaction
JasonEtcocommented, Apr 26, 2018

@pepibumur thanks for that detailed answer - I think I understand a little more what you’re getting at. I misunderstood and thought you were installing multiple apps, when what it sounds like is that you’ve combined Probot apps into one deployment (per these docs I’m guessing).

I’m not sure that we should be building that into Probot core; generally we don’t suggest combining apps, but of course we recognize that for big companies with lots of security and infrastructure needs it might be easier.

I realize this isn’t what you’re asking, but you could do this yourself; combining apps is really just loading those Probot apps’ index.js files as a part of the overarching app’s startup process. To gate that based on a config setting, here’s what it could look like (this is not tested and potentially a bad idea, just sharing some thoughts):

const EventEmitter = require('events')

function bindFakeRobot (path) {
  const events = new EventEmitter()
  const plugin = require(path)
  plugin.events = events
  return plugin(events)
}

module.exports = robot => {
  const plugins = {
    autolabeler: bindFakeRobot('./autolabeler/index.js'),
    triager: bindFakeRobot('./triager/index.js')
  }

  robot.on('*', async context => {
    if (context.payload.repository) {
      const config = await context.config('probots.yml')

      Object.keys(plugins).forEach(key => {
        if (config[key]) {
          const event = context.event + (context.payload.action ? `.${context.payload.action}` : '')
          plugin.events.emit(event, context)
        }
      })
    }
  })
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove Outside Collaborators - Probot
Monitors and instantly removes any outside collaborators added to your Organization. ... A .github/remove-outside-collaborators.yml file in the Repository ...
Read more >
Enabling an external content repository for source control - IBM
Set the Versioned Content External Repository – Write Enabled property to false if you want all new content to be stored in the...
Read more >
Top 5 probot Code Examples - Snyk
Learn more about how to use probot, based on probot code examples created from ... .get('/repos/test-repo-owner/test-repo-name/contents/.github/jira.yml') ...
Read more >
building and hosting GitHub Apps on Platform.sh - YouTube
At Platform.sh, we maintain a template GitHub App using Probot that ... apps can control on repositories and organizations - Probot basics.
Read more >
BotSE 2020
Check out our Repository for Bot-Related Research Papers ... including one that will enable you to talk with your GitHub repositories!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found