improved a lot of things

This commit is contained in:
SinachPat
2026-04-29 12:09:18 +01:00
parent dca0aa5768
commit 45be1b935d
22 changed files with 1381 additions and 47 deletions
+10 -5
View File
@@ -52,12 +52,17 @@ export const githubIngester: OriginIngester<GitHubPullRequestPayload> = {
return GitHubPullRequestPayloadSchema.parse(raw);
},
ingest(payload): IngestionResult {
ingest(payload, opts?: { deploymentUrl?: string }): IngestionResult {
const { pull_request: pr, repository } = payload;
// The render URL points to the head commit's deployed preview if available.
// Conventionally: https://<pr-number>.<preview-domain> — caller overrides as needed.
const renderUrl = pr.html_url;
// The render URL should point to a preview deployment (e.g., Vercel or
// Netlify auto-deploy), NOT to the GitHub PR page. GitHub.com sets
// X-Frame-Options: deny, so pr.html_url cannot be iframed.
//
// The caller supplies deploymentUrl from a deployment_status webhook or
// from the GitHub Deployments API. If unavailable, renderUrl is omitted
// and the user can enter a URL manually in the artboard.
const renderUrl = opts?.deploymentUrl;
return {
origin: {
@@ -78,7 +83,7 @@ export const githubIngester: OriginIngester<GitHubPullRequestPayload> = {
},
},
artboardTitle: `PR #${pr.number}: ${pr.title}`,
renderUrl,
...(renderUrl !== undefined ? { renderUrl } : {}),
};
},
};
+3 -2
View File
@@ -14,8 +14,9 @@ export interface IngestionResult {
export interface OriginIngester<TPayload> {
/** Validates and parses the raw webhook payload. Throws ZodError on invalid input. */
parsePayload(raw: unknown): TPayload;
/** Converts a validated payload into an IngestionResult. */
ingest(payload: TPayload): IngestionResult;
/** Converts a validated payload into an IngestionResult.
* @param opts — Connector-specific options (e.g., deploymentUrl for GitHub). */
ingest(payload: TPayload, opts?: Record<string, unknown>): IngestionResult;
}
// ── Shared helpers ────────────────────────────────────────────────────────────