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

actionsflow/webhook2github

Open more actions menu

webhook2github

This API enables forward webhook requests to github repository_dispatch event webhook.

API Endpoint: https://webhook.actionsflow.workers.dev/

Usage

https://webhook.actionsflow.workers.dev/<owner>/<repo>/<your-path>?__token=<your-github-personal-token>

The default response of the webhook will use the github create-a-repository-dispatch-event API response. You can use search params __response_code, __response_content_type, __response_body to specify a custom response.

You can also use headers X-Github-Authorization instead of search params __token for more security.

The webhook also supports the cross-origin resource sharing request.

For example:

curl --request POST 'https://webhook.actionsflow.workers.dev/actionsflow/webhook2github/webhook/webhook?__token=<your-github-personal-token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "key": "value"
}'

Specify response code example:

curl --request POST 'https://webhook.actionsflow.workers.dev/actionsflow/webhook2github/webhook/webhook?__token=<your-github-personal-token>&__response_code=200' \
--header 'Content-Type: application/json' \
--data-raw '{
    "key": "value"
}'

An axios example:

var axios = require('axios')
var data = JSON.stringify({ key: 'value' })

var config = {
  method: 'post',
  url:
    'https://webhook.actionsflow.workers.dev/actionsflow/webhook2github/webhook/webhook?__token=<your-github-personal-token>',

  data: data,
}

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data))
  })
  .catch(function (error) {
    console.log(error)
  })

How It Works

This API will forward the following original webhook request:

https://webhook.actionsflow.workers.dev/<owner>/<repo>/<your-path>?__token=<your-github-personal-token>

To https://api.github.com/repos/<owner>/<repo>/dispatches, with body:

{
  "event_type": "webhook",
  "client_payload": {
    "path": "<your-path>",
    "method": "<request.method>",
    "headers": "<request.headers>",
    "body": "<request body>"
  }
}

So Github actions will be triggered with repository_dispatch event.

About

Forward webhook to github repository_dispatch event

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE_APACHE
MIT
LICENSE_MIT

Contributing

Stars

Watchers

Forks

Packages

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