Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Can we use"*"to represent all events? #32

Copy link
Copy link
@HsiangNianian

Description

@HsiangNianian
Issue body actions

Hi, @bloomberg-oss

Is your feature request related to a problem? Please describe.
In the process of using, I found that many agents need to write corresponding functions separately, especially @webhook.hook() every time. Can I express all events in some way and get the types of events?

Describe the solution you'd like
I hope to use the * parameter to represent all events and give an event_type label.

@webhook.hook("*") #when any event  happened, e. g.  `push`
def event(data, event_type): 
    return event_type # event_type = "push"

I wrote a json configuration file with the following fields:

{
  "star": {
    "created": "{sender.login} starred repo. "
    }
}

the template is:

{
  "event_type": {
      "data.action": "..."
      }
}

if I read the json as config:

@webhook.hook("*")
def event(data, event_type): 
    logging.info(f"{config[event_type]} happened: Action is {config[data['action']]}")
    return "hello"

This could be activate

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.