gr2m / gr2m/github-app-webhook-relay

Simulate "installation", "installation_repositories", "installation_target" events

Open
#6 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5
Forks
1
PR merge metrics
No merged PRs in 30d

Description

By design, the webhook relay cannot subscribe to events that are only supported by apps, because under the hood manual repository hooks and organization hooks are used. See https://github.com/gr2m/github-webhook-relay/#how-it-works

However, we could simulate these events. At least for the `installation` and `installation_repositories` events, we could continuously request [the `GET /repos/{owner}/{repo}/installation` endpoint](https://docs.github.com/en/free-pro-team@latest/rest/apps/apps?apiVersion=2022-11-28#get-a-repository-installation-for-the-authenticated-app) and then emulate the events if an installation was added or removed. We could simulate the `installation_target` event at the same time and just make up the previous name of the owner.

Alternatively we could add a `.simulate()` method for these three events and all the other events that are only supported by GitHub apps:

- [github_app_authorization](https://docs.github.com/en/webhooks/webhook-events-and-payloads#github_app_authorization)
- [deployment_protection_rule](https://docs.github.com/en/webhooks/webhook-events-and-payloads#deployment_protection_rule)
- [deployment_review](https://docs.github.com/en/webhooks/webhook-events-and-payloads#deployment_review)
- [merge_group](https://docs.github.com/en/webhooks/webhook-events-and-payloads#merge_group)
- [personal_access_token_request](https://docs.github.com/en/webhooks/webhook-events-and-payloads#personal_access_token_request)
- [repository_dispatch](https://docs.github.com/en/webhooks/webhook-events-and-payloads#repository_dispatch)

And in some way also [ping](https://docs.github.com/en/webhooks/webhook-events-and-payloads#ping)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.