Skip to content

Webhook External Command #14693

Open
Open
@jolheiser

Description

@jolheiser

Related to #1089

Preface, a plugin system would potentially be nicer, but also more complicated. I've opted to open this proposal to see if there is interest.


I'm in the beginning stages of working out how an external command could work.
In my opinion this could cover a vast majority of cases, as the command could also do any data processing and HTTP calls as necessary.

name: custom-py
# Not sure if this should be a local path or URL. If local, Gitea needs a way to serve it e.g. in the custom/img folder
image: /path/to/image.png 
command: [python, /usr/local/bin/custom.py]
form:
  - title: Channel ID
    help: The channel to post to
    required: true

Things inside form would be used by Gitea to present the webhook form. Probably by transforming the title e.g. channel_id from above.

I'm thinking the current gitea JSON payload could be sent to the command via stdin.
I'm not 100% sure how to pass along form inputs, perhaps an enclosing JSON object ?

{
  "form": {...},
  "payload": {...}
}

Then the command can unmarshal the JSON and do whatever it needs to.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/proposalThe new feature has not been accepted yet but needs to be discussed first.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions