@orgloop/connector-github-webhook 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +106 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/source.d.ts +38 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +253 -0
- package/dist/source.js.map +1 -0
- package/package.json +32 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 OrgLoop contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# @orgloop/connector-github-webhook
|
|
2
|
+
|
|
3
|
+
Receives GitHub webhook POST deliveries for real-time event processing. Uses the same normalizer functions as the polling `@orgloop/connector-github` to produce identical OrgLoop events — but with zero latency instead of polling intervals.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @orgloop/connector-github-webhook
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Configuration
|
|
12
|
+
|
|
13
|
+
```yaml
|
|
14
|
+
sources:
|
|
15
|
+
- id: github-webhook
|
|
16
|
+
connector: "@orgloop/connector-github-webhook"
|
|
17
|
+
config:
|
|
18
|
+
secret: "${GITHUB_WEBHOOK_SECRET}" # HMAC-SHA256 secret (must match GitHub config)
|
|
19
|
+
path: /webhook/github # optional — defaults to source ID
|
|
20
|
+
events: # optional — filter which events to process
|
|
21
|
+
- pull_request.opened
|
|
22
|
+
- pull_request.closed
|
|
23
|
+
- pull_request.merged
|
|
24
|
+
- pull_request.ready_for_review
|
|
25
|
+
- pull_request.review_submitted
|
|
26
|
+
- pull_request_review_comment
|
|
27
|
+
- issue_comment
|
|
28
|
+
- workflow_run.completed
|
|
29
|
+
- check_suite.completed
|
|
30
|
+
buffer_dir: /tmp/orgloop-buffers # optional — persist events across restarts
|
|
31
|
+
poll:
|
|
32
|
+
interval: "30s" # drain interval for buffered webhook events
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Config options
|
|
36
|
+
|
|
37
|
+
| Field | Type | Required | Description |
|
|
38
|
+
|-------|------|----------|-------------|
|
|
39
|
+
| `secret` | `string` | recommended | HMAC-SHA256 secret for signature validation. Supports `${ENV_VAR}` syntax |
|
|
40
|
+
| `path` | `string` | no | URL path for the webhook handler (default: derived from source ID) |
|
|
41
|
+
| `events` | `string[]` | no | Event types to accept (accepts all if omitted) |
|
|
42
|
+
| `buffer_dir` | `string` | no | Directory for persisting buffered events across restarts |
|
|
43
|
+
|
|
44
|
+
## Events emitted
|
|
45
|
+
|
|
46
|
+
All events are emitted as OrgLoop `resource.changed` type. Produces identical event payloads and provenance to `@orgloop/connector-github`.
|
|
47
|
+
|
|
48
|
+
### Supported event types
|
|
49
|
+
|
|
50
|
+
| OrgLoop event string | GitHub webhook event | OrgLoop type |
|
|
51
|
+
|---|---|---|
|
|
52
|
+
| `pull_request.review_submitted` | `pull_request_review` (submitted) | `resource.changed` |
|
|
53
|
+
| `pull_request_review_comment` | `pull_request_review_comment` | `resource.changed` |
|
|
54
|
+
| `issue_comment` | `issue_comment` | `resource.changed` |
|
|
55
|
+
| `pull_request.opened` | `pull_request` (opened) | `resource.changed` |
|
|
56
|
+
| `pull_request.closed` | `pull_request` (closed, not merged) | `resource.changed` |
|
|
57
|
+
| `pull_request.merged` | `pull_request` (closed, merged) | `resource.changed` |
|
|
58
|
+
| `pull_request.ready_for_review` | `pull_request` (ready_for_review) | `resource.changed` |
|
|
59
|
+
| `workflow_run.completed` | `workflow_run` (completed) | `resource.changed` |
|
|
60
|
+
| `check_suite.completed` | `check_suite` (completed) | `resource.changed` |
|
|
61
|
+
|
|
62
|
+
Unknown GitHub event types are emitted as raw `resource.changed` events with the full webhook payload.
|
|
63
|
+
|
|
64
|
+
## Coexistence with polling connector
|
|
65
|
+
|
|
66
|
+
Use both connectors for real-time delivery with polling as a fallback:
|
|
67
|
+
|
|
68
|
+
```yaml
|
|
69
|
+
sources:
|
|
70
|
+
- id: github-webhook
|
|
71
|
+
connector: "@orgloop/connector-github-webhook"
|
|
72
|
+
config:
|
|
73
|
+
secret: "${GITHUB_WEBHOOK_SECRET}"
|
|
74
|
+
poll:
|
|
75
|
+
interval: "30s"
|
|
76
|
+
|
|
77
|
+
- id: github-poll
|
|
78
|
+
connector: "@orgloop/connector-github"
|
|
79
|
+
config:
|
|
80
|
+
repo: "my-org/my-repo"
|
|
81
|
+
token: "${GITHUB_TOKEN}"
|
|
82
|
+
events:
|
|
83
|
+
- pull_request.review_submitted
|
|
84
|
+
- issue_comment
|
|
85
|
+
poll:
|
|
86
|
+
interval: "5m"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Use a dedup transform to avoid processing the same event twice.
|
|
90
|
+
|
|
91
|
+
## GitHub webhook setup
|
|
92
|
+
|
|
93
|
+
1. Go to your repository's **Settings → Webhooks → Add webhook**
|
|
94
|
+
2. Set **Payload URL** to your OrgLoop endpoint (e.g., `https://your-host:4800/webhook/github-webhook`)
|
|
95
|
+
3. Set **Content type** to `application/json`
|
|
96
|
+
4. Set **Secret** to your `GITHUB_WEBHOOK_SECRET` value
|
|
97
|
+
5. Select the events you want to receive (or choose "Send me everything")
|
|
98
|
+
|
|
99
|
+
## Signature validation
|
|
100
|
+
|
|
101
|
+
When `secret` is configured, the connector validates every incoming request using the `X-Hub-Signature-256` header (HMAC-SHA256). Requests with missing or invalid signatures are rejected with HTTP 401.
|
|
102
|
+
|
|
103
|
+
## Limitations
|
|
104
|
+
|
|
105
|
+
- **Requires inbound network access** — the OrgLoop HTTP server must be reachable from GitHub. For local development, use a tunnel service (ngrok, cloudflared, etc.).
|
|
106
|
+
- **No replay** — missed webhook deliveries while the server is down are not recovered. Pair with the polling connector for durability.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @orgloop/connector-github-webhook — GitHub webhook source connector registration.
|
|
3
|
+
*
|
|
4
|
+
* Receives GitHub webhook POST deliveries and normalizes them into OrgLoop events
|
|
5
|
+
* using the same normalizer functions as the polling GitHub connector.
|
|
6
|
+
*/
|
|
7
|
+
import type { ConnectorRegistration } from '@orgloop/sdk';
|
|
8
|
+
export default function register(): ConnectorRegistration;
|
|
9
|
+
export { GitHubWebhookSource } from './source.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAG1D,MAAM,CAAC,OAAO,UAAU,QAAQ,IAAI,qBAAqB,CAuBxD;AAED,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @orgloop/connector-github-webhook — GitHub webhook source connector registration.
|
|
3
|
+
*
|
|
4
|
+
* Receives GitHub webhook POST deliveries and normalizes them into OrgLoop events
|
|
5
|
+
* using the same normalizer functions as the polling GitHub connector.
|
|
6
|
+
*/
|
|
7
|
+
import { GitHubWebhookSource } from './source.js';
|
|
8
|
+
export default function register() {
|
|
9
|
+
return {
|
|
10
|
+
id: 'github-webhook',
|
|
11
|
+
source: GitHubWebhookSource,
|
|
12
|
+
setup: {
|
|
13
|
+
env_vars: [
|
|
14
|
+
{
|
|
15
|
+
name: 'GITHUB_WEBHOOK_SECRET',
|
|
16
|
+
description: 'HMAC-SHA256 secret for validating GitHub webhook signatures',
|
|
17
|
+
help_url: 'https://docs.github.com/en/webhooks/using-webhooks/validating-webhook-deliveries',
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
integrations: [
|
|
21
|
+
{
|
|
22
|
+
id: 'github-webhook-setup',
|
|
23
|
+
description: 'Configure a webhook in your GitHub repository settings pointing to the OrgLoop endpoint',
|
|
24
|
+
platform: 'github',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export { GitHubWebhookSource } from './source.js';
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,CAAC,OAAO,UAAU,QAAQ;IAC/B,OAAO;QACN,EAAE,EAAE,gBAAgB;QACpB,MAAM,EAAE,mBAAmB;QAC3B,KAAK,EAAE;YACN,QAAQ,EAAE;gBACT;oBACC,IAAI,EAAE,uBAAuB;oBAC7B,WAAW,EAAE,6DAA6D;oBAC1E,QAAQ,EACP,kFAAkF;iBACnF;aACD;YACD,YAAY,EAAE;gBACb;oBACC,EAAE,EAAE,sBAAsB;oBAC1B,WAAW,EACV,yFAAyF;oBAC1F,QAAQ,EAAE,QAAQ;iBAClB;aACD;SACD;KACD,CAAC;AACH,CAAC;AAED,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/source.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub webhook source connector — receives GitHub webhook POST deliveries
|
|
3
|
+
* and normalizes them into OrgLoop events using the same normalizers as the
|
|
4
|
+
* polling connector.
|
|
5
|
+
*/
|
|
6
|
+
import type { OrgLoopEvent, PollResult, SourceConfig, SourceConnector, WebhookHandler } from '@orgloop/sdk';
|
|
7
|
+
export interface GitHubWebhookConfig {
|
|
8
|
+
/** HMAC-SHA256 secret for validating webhook signatures */
|
|
9
|
+
secret?: string;
|
|
10
|
+
/** URL path to mount the webhook handler on */
|
|
11
|
+
path?: string;
|
|
12
|
+
/** Event types to accept (e.g., ["pull_request", "issue_comment"]) */
|
|
13
|
+
events?: string[];
|
|
14
|
+
/** Directory for persisting buffered events across restarts */
|
|
15
|
+
buffer_dir?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class GitHubWebhookSource implements SourceConnector {
|
|
18
|
+
readonly id = "github-webhook";
|
|
19
|
+
private secret?;
|
|
20
|
+
private sourceId;
|
|
21
|
+
private allowedEvents?;
|
|
22
|
+
private pendingEvents;
|
|
23
|
+
private bufferPath?;
|
|
24
|
+
init(config: SourceConfig): Promise<void>;
|
|
25
|
+
poll(_checkpoint: string | null): Promise<PollResult>;
|
|
26
|
+
webhook(): WebhookHandler;
|
|
27
|
+
shutdown(): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Normalize a GitHub webhook payload into OrgLoop events.
|
|
30
|
+
* Uses the same normalizer functions as the polling connector.
|
|
31
|
+
*/
|
|
32
|
+
normalizeWebhookPayload(githubEvent: string, payload: Record<string, unknown>): OrgLoopEvent[];
|
|
33
|
+
private isEventAllowed;
|
|
34
|
+
private buildRawEvent;
|
|
35
|
+
private persistEvent;
|
|
36
|
+
private loadBufferedEvents;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAgBH,OAAO,KAAK,EACX,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,eAAe,EACf,cAAc,EACd,MAAM,cAAc,CAAC;AAGtB,MAAM,WAAW,mBAAmB;IACnC,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAeD,qBAAa,mBAAoB,YAAW,eAAe;IAC1D,QAAQ,CAAC,EAAE,oBAAoB;IAC/B,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,QAAQ,CAAoB;IACpC,OAAO,CAAC,aAAa,CAAC,CAAc;IACpC,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,UAAU,CAAC,CAAS;IAEtB,IAAI,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBzC,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC;IAc3D,OAAO,IAAI,cAAc;IAmEnB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B;;;OAGG;IACH,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,EAAE;IAgF9F,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,aAAa;IAmBrB,OAAO,CAAC,YAAY;IAQpB,OAAO,CAAC,kBAAkB;CAU1B"}
|
package/dist/source.js
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub webhook source connector — receives GitHub webhook POST deliveries
|
|
3
|
+
* and normalizes them into OrgLoop events using the same normalizers as the
|
|
4
|
+
* polling connector.
|
|
5
|
+
*/
|
|
6
|
+
import { createHmac, timingSafeEqual } from 'node:crypto';
|
|
7
|
+
import { appendFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
8
|
+
import { join } from 'node:path';
|
|
9
|
+
import { normalizeCheckSuiteCompleted, normalizeIssueComment, normalizePullRequestClosed, normalizePullRequestOpened, normalizePullRequestReadyForReview, normalizePullRequestReview, normalizePullRequestReviewComment, normalizeWorkflowRunFailed, } from '@orgloop/connector-github';
|
|
10
|
+
import { buildEvent } from '@orgloop/sdk';
|
|
11
|
+
/** Resolve env var references like ${WEBHOOK_SECRET} */
|
|
12
|
+
function resolveEnvVar(value) {
|
|
13
|
+
const match = value.match(/^\$\{(.+)\}$/);
|
|
14
|
+
if (match) {
|
|
15
|
+
const envValue = process.env[match[1]];
|
|
16
|
+
if (!envValue) {
|
|
17
|
+
throw new Error(`Environment variable ${match[1]} is not set`);
|
|
18
|
+
}
|
|
19
|
+
return envValue;
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
export class GitHubWebhookSource {
|
|
24
|
+
id = 'github-webhook';
|
|
25
|
+
secret;
|
|
26
|
+
sourceId = 'github-webhook';
|
|
27
|
+
allowedEvents;
|
|
28
|
+
pendingEvents = [];
|
|
29
|
+
bufferPath;
|
|
30
|
+
async init(config) {
|
|
31
|
+
this.sourceId = config.id;
|
|
32
|
+
const cfg = config.config;
|
|
33
|
+
if (cfg.secret) {
|
|
34
|
+
this.secret = resolveEnvVar(cfg.secret);
|
|
35
|
+
}
|
|
36
|
+
if (cfg.events && cfg.events.length > 0) {
|
|
37
|
+
this.allowedEvents = new Set(cfg.events);
|
|
38
|
+
}
|
|
39
|
+
if (cfg.buffer_dir) {
|
|
40
|
+
const dir = resolveEnvVar(cfg.buffer_dir);
|
|
41
|
+
if (!existsSync(dir)) {
|
|
42
|
+
mkdirSync(dir, { recursive: true });
|
|
43
|
+
}
|
|
44
|
+
this.bufferPath = join(dir, `github-webhook-${this.sourceId}.jsonl`);
|
|
45
|
+
this.loadBufferedEvents();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async poll(_checkpoint) {
|
|
49
|
+
let events;
|
|
50
|
+
if (this.bufferPath) {
|
|
51
|
+
events = this.loadBufferedEvents();
|
|
52
|
+
writeFileSync(this.bufferPath, '');
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
events = [...this.pendingEvents];
|
|
56
|
+
this.pendingEvents = [];
|
|
57
|
+
}
|
|
58
|
+
const checkpoint = events.length > 0 ? events[events.length - 1].timestamp : new Date().toISOString();
|
|
59
|
+
return { events, checkpoint };
|
|
60
|
+
}
|
|
61
|
+
webhook() {
|
|
62
|
+
return async (req, res) => {
|
|
63
|
+
if (req.method !== 'POST') {
|
|
64
|
+
res.writeHead(405, { 'Content-Type': 'application/json' });
|
|
65
|
+
res.end(JSON.stringify({ error: 'Method not allowed' }));
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
68
|
+
const bodyStr = await readBody(req);
|
|
69
|
+
// HMAC-SHA256 signature validation
|
|
70
|
+
if (this.secret) {
|
|
71
|
+
const signature = req.headers['x-hub-signature-256'];
|
|
72
|
+
if (!signature) {
|
|
73
|
+
res.writeHead(401, { 'Content-Type': 'application/json' });
|
|
74
|
+
res.end(JSON.stringify({ error: 'Missing X-Hub-Signature-256 header' }));
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
const expected = `sha256=${createHmac('sha256', this.secret).update(bodyStr).digest('hex')}`;
|
|
78
|
+
const sigBuffer = Buffer.from(signature);
|
|
79
|
+
const expectedBuffer = Buffer.from(expected);
|
|
80
|
+
if (sigBuffer.length !== expectedBuffer.length ||
|
|
81
|
+
!timingSafeEqual(sigBuffer, expectedBuffer)) {
|
|
82
|
+
res.writeHead(401, { 'Content-Type': 'application/json' });
|
|
83
|
+
res.end(JSON.stringify({ error: 'Invalid signature' }));
|
|
84
|
+
return [];
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// Parse the webhook event type from GitHub headers
|
|
88
|
+
const githubEvent = req.headers['x-github-event'];
|
|
89
|
+
if (!githubEvent) {
|
|
90
|
+
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
91
|
+
res.end(JSON.stringify({ error: 'Missing X-GitHub-Event header' }));
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
let payload;
|
|
95
|
+
try {
|
|
96
|
+
payload = JSON.parse(bodyStr);
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
100
|
+
res.end(JSON.stringify({ error: 'Invalid JSON payload' }));
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
103
|
+
const events = this.normalizeWebhookPayload(githubEvent, payload);
|
|
104
|
+
for (const event of events) {
|
|
105
|
+
this.persistEvent(event);
|
|
106
|
+
}
|
|
107
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
108
|
+
res.end(JSON.stringify({
|
|
109
|
+
ok: true,
|
|
110
|
+
events_created: events.length,
|
|
111
|
+
event_ids: events.map((e) => e.id),
|
|
112
|
+
}));
|
|
113
|
+
return events;
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
async shutdown() {
|
|
117
|
+
this.pendingEvents = [];
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Normalize a GitHub webhook payload into OrgLoop events.
|
|
121
|
+
* Uses the same normalizer functions as the polling connector.
|
|
122
|
+
*/
|
|
123
|
+
normalizeWebhookPayload(githubEvent, payload) {
|
|
124
|
+
const action = payload.action;
|
|
125
|
+
const repo = payload.repository ?? {};
|
|
126
|
+
switch (githubEvent) {
|
|
127
|
+
case 'pull_request_review': {
|
|
128
|
+
if (!this.isEventAllowed('pull_request.review_submitted'))
|
|
129
|
+
return [];
|
|
130
|
+
const review = payload.review;
|
|
131
|
+
const pr = payload.pull_request;
|
|
132
|
+
if (!review || !pr)
|
|
133
|
+
return [];
|
|
134
|
+
return [normalizePullRequestReview(this.sourceId, review, pr, repo)];
|
|
135
|
+
}
|
|
136
|
+
case 'pull_request_review_comment': {
|
|
137
|
+
if (!this.isEventAllowed('pull_request_review_comment'))
|
|
138
|
+
return [];
|
|
139
|
+
const comment = payload.comment;
|
|
140
|
+
const pr = payload.pull_request;
|
|
141
|
+
if (!comment || !pr)
|
|
142
|
+
return [];
|
|
143
|
+
return [normalizePullRequestReviewComment(this.sourceId, comment, pr, repo)];
|
|
144
|
+
}
|
|
145
|
+
case 'issue_comment': {
|
|
146
|
+
if (!this.isEventAllowed('issue_comment'))
|
|
147
|
+
return [];
|
|
148
|
+
const comment = payload.comment;
|
|
149
|
+
const issue = payload.issue;
|
|
150
|
+
if (!comment || !issue)
|
|
151
|
+
return [];
|
|
152
|
+
return [normalizeIssueComment(this.sourceId, comment, issue, repo)];
|
|
153
|
+
}
|
|
154
|
+
case 'pull_request': {
|
|
155
|
+
const pr = payload.pull_request;
|
|
156
|
+
if (!pr)
|
|
157
|
+
return [];
|
|
158
|
+
if (action === 'closed') {
|
|
159
|
+
if (!this.isEventAllowed('pull_request.closed') &&
|
|
160
|
+
!this.isEventAllowed('pull_request.merged'))
|
|
161
|
+
return [];
|
|
162
|
+
return [normalizePullRequestClosed(this.sourceId, pr, repo)];
|
|
163
|
+
}
|
|
164
|
+
if (action === 'opened') {
|
|
165
|
+
if (!this.isEventAllowed('pull_request.opened'))
|
|
166
|
+
return [];
|
|
167
|
+
return [normalizePullRequestOpened(this.sourceId, pr, repo)];
|
|
168
|
+
}
|
|
169
|
+
if (action === 'ready_for_review') {
|
|
170
|
+
if (!this.isEventAllowed('pull_request.ready_for_review'))
|
|
171
|
+
return [];
|
|
172
|
+
return [normalizePullRequestReadyForReview(this.sourceId, pr, repo)];
|
|
173
|
+
}
|
|
174
|
+
// Unhandled pull_request action — emit raw event
|
|
175
|
+
return this.buildRawEvent(githubEvent, action, payload);
|
|
176
|
+
}
|
|
177
|
+
case 'workflow_run': {
|
|
178
|
+
if (!this.isEventAllowed('workflow_run.completed'))
|
|
179
|
+
return [];
|
|
180
|
+
if (action !== 'completed')
|
|
181
|
+
return [];
|
|
182
|
+
const run = payload.workflow_run;
|
|
183
|
+
if (!run)
|
|
184
|
+
return [];
|
|
185
|
+
const conclusion = run.conclusion;
|
|
186
|
+
if (conclusion === 'failure') {
|
|
187
|
+
return [normalizeWorkflowRunFailed(this.sourceId, run, repo)];
|
|
188
|
+
}
|
|
189
|
+
// Non-failure workflow runs — emit raw event
|
|
190
|
+
return this.buildRawEvent(githubEvent, action, payload);
|
|
191
|
+
}
|
|
192
|
+
case 'check_suite': {
|
|
193
|
+
if (!this.isEventAllowed('check_suite.completed'))
|
|
194
|
+
return [];
|
|
195
|
+
if (action !== 'completed')
|
|
196
|
+
return [];
|
|
197
|
+
const suite = payload.check_suite;
|
|
198
|
+
if (!suite)
|
|
199
|
+
return [];
|
|
200
|
+
return [normalizeCheckSuiteCompleted(this.sourceId, suite, repo)];
|
|
201
|
+
}
|
|
202
|
+
default:
|
|
203
|
+
// Unknown event type — emit raw event for extensibility
|
|
204
|
+
return this.buildRawEvent(githubEvent, action, payload);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
isEventAllowed(eventType) {
|
|
208
|
+
if (!this.allowedEvents)
|
|
209
|
+
return true;
|
|
210
|
+
return this.allowedEvents.has(eventType);
|
|
211
|
+
}
|
|
212
|
+
buildRawEvent(githubEvent, action, payload) {
|
|
213
|
+
const platformEvent = action ? `${githubEvent}.${action}` : githubEvent;
|
|
214
|
+
return [
|
|
215
|
+
buildEvent({
|
|
216
|
+
source: this.sourceId,
|
|
217
|
+
type: 'resource.changed',
|
|
218
|
+
provenance: {
|
|
219
|
+
platform: 'github',
|
|
220
|
+
platform_event: platformEvent,
|
|
221
|
+
},
|
|
222
|
+
payload,
|
|
223
|
+
}),
|
|
224
|
+
];
|
|
225
|
+
}
|
|
226
|
+
persistEvent(event) {
|
|
227
|
+
if (this.bufferPath) {
|
|
228
|
+
appendFileSync(this.bufferPath, `${JSON.stringify(event)}\n`);
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
this.pendingEvents.push(event);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
loadBufferedEvents() {
|
|
235
|
+
if (!this.bufferPath || !existsSync(this.bufferPath)) {
|
|
236
|
+
return [];
|
|
237
|
+
}
|
|
238
|
+
const content = readFileSync(this.bufferPath, 'utf-8').trim();
|
|
239
|
+
if (!content) {
|
|
240
|
+
return [];
|
|
241
|
+
}
|
|
242
|
+
return content.split('\n').map((line) => JSON.parse(line));
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
function readBody(req) {
|
|
246
|
+
return new Promise((resolve, reject) => {
|
|
247
|
+
const chunks = [];
|
|
248
|
+
req.on('data', (chunk) => chunks.push(chunk));
|
|
249
|
+
req.on('end', () => resolve(Buffer.concat(chunks).toString('utf-8')));
|
|
250
|
+
req.on('error', reject);
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
//# sourceMappingURL=source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.js","sourceRoot":"","sources":["../src/source.ts"],"names":[],"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YAAY,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9D,IAAI,CAAC,OAAO,EAAE,CAAC;YACd,OAAO,EAAE,CAAC;QACX,CAAC;QACD,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAiB,CAAC,CAAC;IAC5E,CAAC;CACD;AAED,SAAS,QAAQ,CAAC,GAAoB;IACrC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACtD,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACtE,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@orgloop/connector-github-webhook",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "OrgLoop GitHub webhook connector — real-time event delivery via GitHub webhooks",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"@orgloop/sdk": "0.7.1",
|
|
10
|
+
"@orgloop/connector-github": "0.1.10"
|
|
11
|
+
},
|
|
12
|
+
"orgloop": {
|
|
13
|
+
"type": "connector",
|
|
14
|
+
"provides": [
|
|
15
|
+
"source"
|
|
16
|
+
],
|
|
17
|
+
"id": "github-webhook"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc",
|
|
28
|
+
"clean": "rm -rf dist",
|
|
29
|
+
"typecheck": "tsc --noEmit",
|
|
30
|
+
"test": "vitest run"
|
|
31
|
+
}
|
|
32
|
+
}
|