hubot-github-repo-event-notifier icon indicating copy to clipboard operation
hubot-github-repo-event-notifier copied to clipboard

Is there a way to add my own hooks for certain events?

Open Taytay opened this issue 9 years ago • 6 comments

I'd like to be able to respond to these events with some scripts of my own. From what I can tell, there isn't a way to add my own handler methods, is there?

Taytay avatar Mar 03 '15 23:03 Taytay

Not presently, no.

What kind of API would you envision?

parkr avatar Mar 04 '15 00:03 parkr

Hey @Taytay! (Beat me to it, @parkr :)

Couldn't we emit a github-event-received action with an event type arg and let people set up listeners?

EDIT: Actually @parkr, you're right to ask "what would you like to do?" first..!

patcon avatar Mar 04 '15 00:03 patcon

You could indeed! ;) In fact, that's what I'm doing now in my local fork:

      if eventType in eventTypes
        # Emit the event for other scripts to handle
        robot.emit "github-repo-event", {
            data        : data,
            eventType   : eventType
            room : room
        }
        announceRepoEvent data, eventType, (what) ->
          robot.messageRoom room, what

It's been easy to work with so far.

Taytay avatar Mar 04 '15 01:03 Taytay

Oh, and thanks for this project! Good stuff! :)

Taytay avatar Mar 04 '15 01:03 Taytay

@Taytay @parkr - would it be worth opening a PR for the robot.emit?

My use would be to automatically create a new JIRA ticket when an issue is raised, and since hubot already knows about all this, it'd be very handy to make use of it.

niklasR avatar Sep 22 '17 15:09 niklasR

Yeah, go for it! but please provide tests so we can merge easily :)

patcon avatar Oct 06 '17 08:10 patcon