:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(workflows): trigger a workflow from GitHub activity (#84460)
Ben Whitedec91b5994a3
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsxindex a22e7231e148..39057c9de836 100644--- a/frontend/src/lib/constants.tsx+++ b/frontend/src/lib/constants.tsx@@ -345,6 +345,7 @@ export const FEATURE_FLAGS = {FIELD_NOTES: 'field-notes', // owner: @adamleithFLAG_EVALUATION_TAGS: 'flag-evaluation-tags', // owner: @dmarticus #team-feature-flagsFLAGGED_FEATURE_INDICATOR: 'flagged-feature-indicator', // owner: @benjackwhite+ GITHUB_WORKFLOW_TRIGGERS: 'github-workflow-triggers', // owner: #team-workflows-cdpGROUP_PROFILE_EXPERIMENT: 'group-profile-experiment', // owner: @arthurdedeus #team-customer-analyticsHEALTH_ASK_AI: 'health-ask-ai', // owner: @jordanm-posthog #team-web-analytics, gates the "Ask PostHog AI" buttons on the Health overviewHOGQL_WAREHOUSE_ACCESS_CONTROL: 'hogql-warehouse-access-control', // owner: @a-lider #team-platform-features, gates per-object access control for warehouse tables and viewsdiff --git a/frontend/src/lib/integrations/GitHubIntegrationHelpers.test.tsx b/frontend/src/lib/integrations/GitHubIntegrationHelpers.test.tsxnew file mode 100644index 000000000000..656fb667bcfb--- /dev/null+++ b/frontend/src/lib/integrations/GitHubIntegrationHelpers.test.tsx@@ -0,0 +1,61 @@+import '@testing-library/jest-dom'++import { act, cleanup, render, screen } from '@testing-library/react'+import { Provider } from 'kea'++import { useMocks } from '~/mocks/jest'+import { initKeaTests } from '~/test/init'++import { useRepositories } from './GitHubIntegrationHelpers'++const REPOS = [{ id: 1, name: 'posthog', full_name: 'PostHog/posthog', pushed_at: '2026-01-02T00:00:00Z' }]++function OptionKeysProbe({ valueKey }: { valueKey?: 'name' | 'full_name' }): JSX.Element {+ const { options, loading } = useRepositories(1, { valueKey })+ return <div data-attr="option-keys">{loading ? 'LOADING' : options.map((o) => o.key).join(',')}</div>+}++describe('useRepositories', () => {+ beforeEach(() => {+ useMocks({+ get: {+ '/api/environments/:team_id/integrations/:id/github_repos': () => [+ 200,+ { repositories: REPOS, has_more: false, total: 1 },+ ],+ },+ })+ initKeaTests()+ })++ afterEach(() => {+ cleanup()+ })++ // The emitted `$github_event_received` event carries the qualified name (owner/repo). A picker+ // that keys its option on the short name instead compiles a repository filter that no+ // delivery can ever match - the bug this option exists to avoid.+ it('keys options on the qualified name when valueKey is full_name', async () => {+ render(+ <Provider>+ <OptionKeysProbe valueKey="full_name" />+ </Provider>+ )+ await act(() => new Promise((r) => setTimeout(r, 500)))++ expect(screen.getByTestId('option-keys')).toHaveTextContent('PostHog/posthog')+ })++ it('keys options on the short name by default, unchanged for existing callers', async () => {+ render(+ <Provider>+ <OptionKeysProbe />+ </Provider>+ )+ await act(() => new Promise((r) => setTimeout(r, 500)))++ const content = screen.getByTestId('option-keys')+ expect(content).toHaveTextContent('posthog')+ expect(content.textContent).not.toBe('PostHog/posthog')+ })+})diff --git a/frontend/src/lib/integrations/GitHubIntegrationHelpers.tsx b/frontend/src/lib/integrations/GitHubIntegrationHelpers.tsxindex 48dbe2cda54b..52cccf4457b5 100644--- a/frontend/src/lib/integrations/GitHubIntegrationHelpers.tsx+++ b/frontend/src/lib/integrations/GitHubIntegrationHelpers.tsx@@ -36,6 +36,10 @@ export type GitHubRepositoryPickerProps = {value: stringonChange: (value: string) => voidclassName?: string+ /** Which repo field the picker stores and returns. Default 'name' keeps existing callers'+ * stored short names working; 'full_name' is for callers matching a webhook delivery's+ * "owner/repo" property, which carries no owner otherwise. */+ valueKey?: 'name' | 'full_name'}export const GitHubRepositoryPicker = ({@@ -43,8 +47,9 @@ export const GitHubRepositoryPicker = ({onChange,integrationId,className,+ valueKey,}: GitHubRepositoryPickerProps): JSX.Element => {- const { options, loading } = useRepositories(integrationId)+ const { options, loading } = useRepositories(integrationId, { valueKey })return (<LemonInputSelect@@ -154,7 +159,10 @@ function RepoOptionLabel({ repo }: { repo: GitHubRepoApi }): JSX.Element {)}-export function useRepositories(integrationId: number): { options: LemonInputSelectOption[]; loading: boolean } {+export function useRepositories(+ integrationId: number,+ { valueKey = 'name' }: { valueKey?: 'name' | 'full_name' } = {}+): { options: LemonInputSelectOption[]; loading: boolean } {const logic = githubIntegrationLogic({ id: integrationId })const { repositories, repositoriesLoading } = useValues(logic)const { loadRepositories } = useActions(logic)@@ -168,8 +176,8 @@ export function useRepositories(integrationId: number): { options: LemonInputSel// Most-recently-pushed first so the repo the user is working in floats to the top.[...repositories].sort((a, b) => pushedAtMs(b.pushed_at) - pushedAtMs(a.pushed_at))- .map((r) => ({ key: r.name, label: r.full_name, labelComponent: <RepoOptionLabel repo={r} /> })),- [repositories]+ .map((r) => ({ key: r[valueKey], label: r.full_name, labelComponent: <RepoOptionLabel repo={r} /> })),+ [repositories, valueKey])return { options, loading: repositoriesLoading }diff --git a/nodejs/src/cdp/consumers/cdp-cyclotron-worker-hogflow.consumer.ts b/nodejs/src/cdp/consumers/cdp-cyclotron-worker-hogflow.consumer.tsindex d751e4a13171..c901be0a761a 100644--- a/nodejs/src/cdp/consumers/cdp-cyclotron-worker-hogflow.consumer.ts+++ b/nodejs/src/cdp/consumers/cdp-cyclotron-worker-hogflow.consumer.ts@@ -116,11 +116,12 @@ export class CdpCyclotronWorkerHogFlow extends CdpCyclotronWorker {const hogFlowInvocationState = item.state as CyclotronJobInvocationHogFlow['state']- // Warehouse-row invocations don't have a real person — the row is the unit of work- // and person-dependent steps no-op for these flows. Explicitly skip the person lookup- // rather than relying on event.distinct_id being empty so future changes to the- // synthetic event shape don't accidentally re-enable the lookup.- const isWarehouseRow = isRowScopedTrigger(hogFlow.trigger)+ // Row-scoped invocations (a warehouse row, a Slack message, a GitHub event) don't have+ // a real person — the delivery is the unit of work and person-dependent steps no-op for+ // these flows. Explicitly skip the person lookup rather than relying on+ // event.distinct_id being empty so future changes to the synthetic event shape don't+ // accidentally re-enable the lookup.+ const isRowScoped = isRowScopedTrigger(hogFlow.trigger)// Account-audience batch invocations carry the account's group key as// event.distinct_id; resolving it as a person distinct_id would attach an// unrelated person to the run. Accounts have no person — skip the lookup.@@ -143,7 +144,7 @@ export class CdpCyclotronWorkerHogFlow extends CdpCyclotronWorker {delete hogFlowInvocationState.personIdRepointed}const personIdOrDistinctId =- isWarehouseRow || isAccountAudience+ isRowScoped || isAccountAudience? undefined: resolveByRepointedPerson? hogFlowInvocationState.personIddiff --git a/nodejs/src/cdp/consumers/cdp-cyclotron-worker-hogflow.test.ts b/nodejs/src/cdp/consumers/cdp-cyclotron-worker-hogflow.test.tsindex 69cf86b8afde..5b501a8335e7 100644--- a/nodejs/src/cdp/consumers/cdp-cyclotron-worker-hogflow.test.ts+++ b/nodejs/src/cdp/consumers/cdp-cyclotron-worker-hogflow.test.ts@@ -222,6 +222,20 @@ describe('CdpCyclotronWorkerHogFlow', () => {.build()))++ hogFlows.push(+ await insertHogFlow(+ hub.postgres,+ new FixtureHogFlowBuilder()+ .withName('Test GitHub Hog Flow')+ .withTeamId(team.id)+ .withStatus('active')+ .withSimpleWorkflow({+ trigger: { type: 'github-event', filters: { properties: [], bytecode: ['_h', 29] } } as any,+ })+ .build()+ )+ )})afterEach(async () => {@@ -351,6 +365,26 @@ describe('CdpCyclotronWorkerHogFlow', () => {`)})+ it('does not resolve a person for a row-scoped trigger, even when distinct_id matches one', async () => {+ // github-event (like slack-message and the warehouse triggers) is row-scoped: the+ // delivery is the unit of work, and its "distinct_id" is a GitHub login or Slack user+ // id, not a PostHog person. Resolving it anyway would attach whichever person happens+ // to share that distinct_id - here, one that genuinely exists - to an unrelated run.+ const personManagerSpy = jest.spyOn(processor['personsManager'] as any, 'fetchPersonsByDistinctIds')+ const invocation = createSerializedHogFlowInvocation(hogFlows[3], {+ event: { distinct_id: 'distinct_A_1', properties: { repository: 'PostHog/posthog' } } as any,+ })++ const results = (await processor.processInvocations([+ invocation,+ ])) as CyclotronJobInvocationResult<CyclotronJobInvocationHogFlow>[]++ expect(results).toHaveLength(1)+ expect(results[0].invocation.person).toBeUndefined()+ expect(results[0].invocation.filterGlobals?.person).toBeNull()+ expect(personManagerSpy).not.toHaveBeenCalled()+ })+it('should make minimal calls to the person manager', async () => {const personManagerSpy = jest.spyOn(processor['personsManager'] as any, 'fetchPersonsByDistinctIds')await processor.processInvocations(invocations)diff --git a/nodejs/src/cdp/consumers/cdp-internal-event.consumer.ts b/nodejs/src/cdp/consumers/cdp-internal-event.consumer.tsindex 801cc180a655..3cf8be474557 100644--- a/nodejs/src/cdp/consumers/cdp-internal-event.consumer.ts+++ b/nodejs/src/cdp/consumers/cdp-internal-event.consumer.ts@@ -19,9 +19,27 @@ import { CdpConsumerBase, CdpConsumerBaseDeps } from './cdp-base.consumer'import { counterParseError } from './metrics'const SLACK_MESSAGE_RECEIVED_EVENT = '$slack_message_received'+const GITHUB_EVENT_RECEIVED_EVENT = '$github_event_received'// The event that starts each trigger type. Type alone would match every other signal on this topic.-const INTERNAL_EVENT_TRIGGER_EVENTS = new Map([['slack-message', SLACK_MESSAGE_RECEIVED_EVENT]])+const INTERNAL_EVENT_TRIGGER_EVENTS = new Map([+ ['slack-message', SLACK_MESSAGE_RECEIVED_EVENT],+ ['github-event', GITHUB_EVENT_RECEIVED_EVENT],+])++/**+ * Whether a GitHub delivery is a write PostHog's own GitHub App made, resolved from the `own_app`+ * property the emit stamps on the event.+ *+ * A workflow that comments back on an issue sees its own comment arrive on this topic, so without+ * this it retriggers itself forever. Checked at eligibility rather than a trigger's stored filters,+ * which a workflow created through the API or MCP would not carry. Unlike Slack's equivalent, this+ * needs no integration lookup: one GitHub App per environment posts for every installation, so the+ * emit can resolve "is this us" from its own instance setting before the event ever reaches Kafka.+ */+function isOwnGithubEvent(globals: HogFunctionInvocationGlobals): boolean {+ return globals.event.event === GITHUB_EVENT_RECEIVED_EVENT && globals.event.properties.own_app === true+}export class CdpInternalEventsConsumer extends CdpConsumerBase {protected name = 'CdpInternalEventsConsumer'@@ -106,7 +124,8 @@ export class CdpInternalEventsConsumer extends CdpConsumerBase {this.hogFlowPipeline.buildInvocations(invocationGlobals, {eligibilityFn: (flow, globals) =>INTERNAL_EVENT_TRIGGER_EVENTS.get(flow.trigger.type) === globals.event.event &&- !ownSlackMessages.has(globals),+ !ownSlackMessages.has(globals) &&+ !isOwnGithubEvent(globals),}),])diff --git a/nodejs/src/cdp/consumers/cdp-internal-events-consumer.test.ts b/nodejs/src/cdp/consumers/cdp-internal-events-consumer.test.tsindex 52074f0a2862..f88113fb2ff4 100644--- a/nodejs/src/cdp/consumers/cdp-internal-events-consumer.test.ts+++ b/nodejs/src/cdp/consumers/cdp-internal-events-consumer.test.ts@@ -313,6 +313,17 @@ describe('CDP Internal Events Consumer', () => {},})+ const githubEvent = (teamId: number, properties: Record<string, any> = {}) =>+ createInternalEvent(teamId, {+ event: {+ timestamp: '2026-08-17T12:00:00.000Z',+ uuid: 'aaaaaaaa-bbbb-cccc-dddd-11111111111',+ event: '$github_event_received',+ distinct_id: 'octocat',+ properties: { repository: 'PostHog/posthog', event_type: 'issues', own_app: false, ...properties },+ },+ })+it('should start a workflow whose trigger is a slack message', async () => {const hogFlow = await _insertHogFlow(hub.postgres, buildHogFlow(team.id, { type: 'slack-message' }))@@ -384,6 +395,37 @@ describe('CDP Internal Events Consumer', () => {expect(invocations.filter((i: any) => i.hogFlow)).toHaveLength(expected)})+ it('should start a workflow whose trigger is a github event', async () => {+ const hogFlow = await _insertHogFlow(hub.postgres, buildHogFlow(team.id, { type: 'github-event' }))++ const globals = await processor._parseKafkaBatch([createKafkaMessage(githubEvent(team.id))])+ const { invocations } = await processor.processBatch(globals)++ const hogFlowInvocations = invocations.filter((i: any) => i.hogFlow)+ expect(hogFlowInvocations).toHaveLength(1)+ expect(hogFlowInvocations[0].functionId).toBe(hogFlow.id)+ })++ it.each([+ ['own_app is stamped true', true, 0],+ ['own_app is stamped false', false, 1],+ ])(+ 'starts a github workflow only when the delivery is not our own write: %s',+ async (_name, ownApp, expected) => {+ // A workflow that comments back on an issue sees its own comment arrive on this topic.+ // The guard is part of eligibility, not the trigger's stored filters, so a workflow+ // created through the API or MCP still has it.+ await _insertHogFlow(hub.postgres, buildHogFlow(team.id, { type: 'github-event' }))++ const globals = await processor._parseKafkaBatch([+ createKafkaMessage(githubEvent(team.id, { own_app: ownApp })),+ ])+ const { invocations } = await processor.processBatch(globals)++ expect(invocations.filter((i: any) => i.hogFlow)).toHaveLength(expected)+ }+ )+it('should parse a message for a team that has a hog flow but no hog functions', async () => {// The parse step used to drop any team with no internal_destination functions, which// would discard the event before the flow pipeline ever saw it.diff --git a/nodejs/src/cdp/schema/hogflow.ts b/nodejs/src/cdp/schema/hogflow.tsindex ea85d81d84fb..fbaf57d6fa72 100644--- a/nodejs/src/cdp/schema/hogflow.ts+++ b/nodejs/src/cdp/schema/hogflow.ts@@ -112,6 +112,14 @@ const HogFlowTriggerSchema = z.discriminatedUnion('type', [// Optional row column used as the masking / dedup key in place of distinct_idkey_property: z.string().optional(),}),+ z.object({+ type: z.literal('github-event'),+ filters: z.object({+ // Delivery-property filters only, on the same footing as slack-message: repository,+ // event type and actor are all properties rather than fields of their own.+ properties: z.array(z.any()).optional(),+ }),+ }),])export const HogFlowActionSchema = z.discriminatedUnion('type', [@@ -351,14 +359,23 @@ export const HogFlowSchema = z.object({updated_at: z.union([z.number(), z.string(), z.date()]).optional(),})-export type RowScopedTrigger = Extract<HogFlow['trigger'], { type: 'data-warehouse-table' | 'data-warehouse-view' }>+export type RowScopedTrigger = Extract<+ HogFlow['trigger'],+ { type: 'data-warehouse-table' | 'data-warehouse-view' | 'slack-message' | 'github-event' }+>/**- * A warehouse-row trigger produces one run per row, with the row's columns under- * `event.properties` and no person attached.+ * A row-scoped trigger produces one run per delivery (a warehouse row, a Slack message, a GitHub+ * event), with the delivery's own properties under `event.properties` and no person attached.+ * Keep in sync with the backend's ROW_SCOPED_TRIGGER_TYPES.*/export function isRowScopedTrigger(trigger: HogFlow['trigger']): trigger is RowScopedTrigger {- return trigger?.type === 'data-warehouse-table' || trigger?.type === 'data-warehouse-view'+ return (+ trigger?.type === 'data-warehouse-table' ||+ trigger?.type === 'data-warehouse-view' ||+ trigger?.type === 'slack-message' ||+ trigger?.type === 'github-event'+ )}// NOTE: these are purposefully exported as interfaces to support kea typegendiff --git a/nodejs/src/cdp/services/hogflows/hogflow-executor.service.ts b/nodejs/src/cdp/services/hogflows/hogflow-executor.service.tsindex b393d8dfca7b..1a65c9c13269 100644--- a/nodejs/src/cdp/services/hogflows/hogflow-executor.service.ts+++ b/nodejs/src/cdp/services/hogflows/hogflow-executor.service.ts@@ -184,7 +184,9 @@ export class HogFlowExecutorService {const trigger = hogFlow.trigger// Defensive: only the trigger types that carry `filters` make it through eligibility.- if (trigger.type !== 'event' && trigger.type !== 'slack-message' && !isRowScopedTrigger(trigger)) {+ // isRowScopedTrigger now covers slack-message and github-event too, alongside the two+ // warehouse types.+ if (trigger.type !== 'event' && !isRowScopedTrigger(trigger)) {continue}diff --git a/posthog/settings/__init__.py b/posthog/settings/__init__.pyindex bd5a0f3f8eeb..f9f1fac1a1e3 100644--- a/posthog/settings/__init__.py+++ b/posthog/settings/__init__.py@@ -87,6 +87,10 @@ SLACK_APP_LOCAL_DEV_EMAIL: str = os.getenv("SLACK_APP_LOCAL_DEV_EMAIL", "test@po# firehose, so it doubles as the kill switch.SLACK_WORKFLOW_TRIGGERS_ENABLED: bool = get_from_env("SLACK_WORKFLOW_TRIGGERS_ENABLED", False, type_cast=str_to_bool)+# Same for GitHub App deliveries. Off by default for the same reason: a busy repository is a+# firehose, and this is the only thing admitting it.+GITHUB_WORKFLOW_TRIGGERS_ENABLED: bool = get_from_env("GITHUB_WORKFLOW_TRIGGERS_ENABLED", False, type_cast=str_to_bool)+# Vapi voice-AI integration (used by user_interviews to host public interview pages).VAPI_PUBLIC_KEY: str = os.getenv("VAPI_PUBLIC_KEY", "")VAPI_ASSISTANT_ID: str = os.getenv("VAPI_ASSISTANT_ID", "")diff --git a/posthog/urls.py b/posthog/urls.pyindex e2fd7c1e0812..6378e58831fb 100644--- a/posthog/urls.py+++ b/posthog/urls.py@@ -171,6 +171,15 @@ def _dispatch_loop_triggers(request: HttpRequest, event_type: str, payload: dictreturn None+def _dispatch_workflow_triggers(+ request: HttpRequest, event_type: str, payload: dict[str, Any], delivery_id: str+) -> None:+ from products.workflows.backend.github_workflow_events import emit_github_event++ emit_github_event(event_type, payload, delivery_id)+ return None++# event_type -> ordered list of (handler_name, handler). Order matters only in that# the first handler in a bucket to return a non-None HttpResponse determines the# response sent back to GitHub; the pre-existing single handler in each bucket keeps@@ -179,17 +188,21 @@ GITHUB_WEBHOOK_HANDLERS: dict[str, list[tuple[str, GithubWebhookHandler]]] = {"issues": [("conversations", _dispatch_conversations_event),("loops", _dispatch_loop_triggers),+ ("workflows", _dispatch_workflow_triggers),],"issue_comment": [("conversations", _dispatch_conversations_event),("loops", _dispatch_loop_triggers),+ ("workflows", _dispatch_workflow_triggers),],"pull_request": [("tasks_pr_backstop", _dispatch_pull_request_event),("loops", _dispatch_loop_triggers),+ ("workflows", _dispatch_workflow_triggers),],"pull_request_review": [("tasks_pr_review", _dispatch_pull_request_review_event),+ ("workflows", _dispatch_workflow_triggers),],"installation": [("installation_lifecycle", _dispatch_installation_event),@@ -199,6 +212,7 @@ GITHUB_WEBHOOK_HANDLERS: dict[str, list[tuple[str, GithubWebhookHandler]]] = {],"push": [("loops", _dispatch_loop_triggers),+ ("workflows", _dispatch_workflow_triggers),],}diff --git a/products/workflows/backend/api/hog_flow.py b/products/workflows/backend/api/hog_flow.pyindex 702c0e141170..f36f2797093b 100644--- a/products/workflows/backend/api/hog_flow.py+++ b/products/workflows/backend/api/hog_flow.py@@ -817,6 +817,29 @@ def _has_slack_channel_filter(filters: dict) -> bool:return False+def _has_exact_string_filter(filters: dict, key: str) -> bool:+ """Whether the filters restrict the trigger by an exact, non-empty value for the given key.++ Shared by the GitHub trigger's repository and event-type requirements below - both need the+ same "is this key pinned to something" check that `_has_slack_channel_filter` does for+ Slack's channel.+ """+ properties = filters.get("properties")+ if not isinstance(properties, list):+ return False+ for prop in properties:+ if not isinstance(prop, dict) or prop.get("key") != key:+ continue+ if (prop.get("operator") or "exact") != "exact":+ continue+ value = prop.get("value")+ if isinstance(value, str) and value.strip():+ return True+ if isinstance(value, list) and any(isinstance(item, str) and item.strip() for item in value):+ return True+ return False++def _existing_email_from_by_action(instance: "HogFlow") -> dict[str, list[dict]]:"""Stored email sender overrides keyed by action id, live and draft variants both kept.@@ -1108,10 +1131,17 @@ class HogFlowActionSerializer(serializers.Serializer):config = HogFlowActionConfigField(help_text=("Type-specific config keyed by action type. "- "trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message, filters?}. "+ "trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, "+ "filters?}. ""slack-message runs once per message posted in a connected Slack channel, and takes only ""filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, ""subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. "+ "github-event runs once per matching GitHub delivery, and takes only filters: "+ "{properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, "+ "bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, "+ "repository_visibility). repository and event_type are required, each with an exact-match filter; "+ "without them the trigger runs on every delivery from every connected repository. Runs are "+ "person-less, so person-dependent steps are rejected. ""webhook and ""manual triggers also require template_id: 'template-source-webhook', and tracking_pixel ""requires template_id: 'template-source-webhook-pixel'. "@@ -1438,6 +1468,34 @@ class HogFlowActionSerializer(serializers.Serializer):else:serializer.is_valid(raise_exception=True)data["config"]["filters"] = serializer.validated_data+ elif data.get("config", {}).get("type") == "github-event":+ # Repository, event type and actor are all properties of the delivery rather than+ # fields of their own, so there is no config beyond the filters - same shape as+ # slack-message.+ filters = data.get("config", {}).get("filters", {}) or {}+ if not isinstance(filters, dict):+ raise serializers.ValidationError({"filters": "Filters must be a dictionary."})+ filters.pop("events", None)+ filters.pop("actions", None)+ if not is_draft and not _has_exact_string_filter(filters, "repository"):+ raise serializers.ValidationError(+ {+ "filters": "Pick a repository for this trigger. Without one it runs on every delivery from every repository the GitHub app is installed on."+ }+ )+ if not is_draft and not _has_exact_string_filter(filters, "event_type"):+ raise serializers.ValidationError(+ {"filters": "Pick at least one event, or the trigger will never fire."}+ )+ # Left on the default "events" source: the internal event is event-shaped, so+ # property filters compile against event.properties.* with no special casing.+ serializer = HogFunctionFiltersSerializer(data=filters, context=self.context)+ if is_draft:+ if serializer.is_valid():+ data["config"]["filters"] = serializer.validated_data+ else:+ serializer.is_valid(raise_exception=True)+ data["config"]["filters"] = serializer.validated_dataelse:if strict:raise serializers.ValidationError({"config": "Invalid trigger type"})diff --git a/products/workflows/backend/api/test/test_hog_flow.py b/products/workflows/backend/api/test/test_hog_flow.pyindex c514074d8203..d7d58fad398a 100644--- a/products/workflows/backend/api/test/test_hog_flow.py+++ b/products/workflows/backend/api/test/test_hog_flow.py@@ -2501,6 +2501,128 @@ class TestHogFlowAPI(APIBaseTest):response = self.client.post(f"/api/projects/{self.team.id}/hog_flows", hog_flow)assert response.status_code == 201, response.json()+ @staticmethod+ def _github_trigger_action(properties: list[dict]) -> dict:+ return {+ "id": "trigger_node",+ "name": "trigger_1",+ "type": "trigger",+ "config": {"type": "github-event", "filters": {"properties": properties}},+ }++ def test_hog_flow_github_trigger_saves_and_compiles_filters(self):+ # Before this branch existed, github-event fell through to "Invalid trigger type" on every+ # non-draft save, so the trigger this registers in the frontend could never activate.+ properties = [+ {"key": "repository", "value": ["PostHog/posthog"], "operator": "exact", "type": "event"},+ {"key": "event_type", "value": ["issues"], "operator": "exact", "type": "event"},+ ]+ hog_flow = {+ "name": "Test GitHub Flow",+ "status": "active",+ "actions": [self._github_trigger_action(properties)],+ }++ response = self.client.post(f"/api/projects/{self.team.id}/hog_flows", hog_flow)+ assert response.status_code == 201, response.json()+ stored = response.json()["trigger"]["filters"]["properties"]+ assert {p["key"] for p in stored} == {"repository", "event_type"}++ @parameterized.expand(+ [+ ("no_properties", []),+ (+ "no_repository_entry",+ [{"key": "event_type", "value": ["issues"], "operator": "exact", "type": "event"}],+ ),+ (+ "blank_repository_value",+ [+ {"key": "repository", "value": [""], "operator": "exact", "type": "event"},+ {"key": "event_type", "value": ["issues"], "operator": "exact", "type": "event"},+ ],+ ),+ # Presence operators store the operator string as the value, so the value looks+ # non-empty while the compiled filter matches every repository.+ (+ "is_set_repository",+ [+ {"key": "repository", "value": "is_set", "operator": "is_set", "type": "event"},+ {"key": "event_type", "value": ["issues"], "operator": "exact", "type": "event"},+ ],+ ),+ (+ "negated_repository",+ [+ {"key": "repository", "value": ["PostHog/posthog"], "operator": "is_not", "type": "event"},+ {"key": "event_type", "value": ["issues"], "operator": "exact", "type": "event"},+ ],+ ),+ (+ "regex_repository",+ [+ {"key": "repository", "value": [".*"], "operator": "regex", "type": "event"},+ {"key": "event_type", "value": ["issues"], "operator": "exact", "type": "event"},+ ],+ ),+ ]+ )+ def test_hog_flow_github_trigger_requires_a_repository_filter_to_activate(self, _name, properties):+ # Only the builder UI asks for a repository; without this server-side check, a flow+ # activated via the raw API or MCP fires on every delivery from every repository the+ # GitHub app is installed on.+ hog_flow = {+ "name": "Test GitHub Flow",+ "status": "active",+ "actions": [self._github_trigger_action(properties)],+ }++ response = self.client.post(f"/api/projects/{self.team.id}/hog_flows", hog_flow)+ assert response.status_code == 400, response.json()+ assert "repository" in response.json()["detail"].lower()++ def test_hog_flow_github_trigger_requires_an_event_type_filter_to_activate(self):+ # Same requirement, the sibling key: a repository alone still fires on every event type+ # the workflows handler is registered for.+ properties = [{"key": "repository", "value": ["PostHog/posthog"], "operator": "exact", "type": "event"}]+ hog_flow = {+ "name": "Test GitHub Flow",+ "status": "active",+ "actions": [self._github_trigger_action(properties)],+ }++ response = self.client.post(f"/api/projects/{self.team.id}/hog_flows", hog_flow)+ assert response.status_code == 400, response.json()+ assert "event" in response.json()["detail"].lower()++ def test_hog_flow_github_trigger_gap_is_caught_at_enable(self):+ # The workflows table's Enable button patches status alone, skipping the builder's+ # repository validation, so activation-time re-validation is what has to catch it.+ draft = self.client.post(+ f"/api/projects/{self.team.id}/hog_flows",+ {"name": "Test GitHub Flow", "status": "draft", "actions": [self._github_trigger_action([])]},+ )+ assert draft.status_code == 201, draft.json()++ response = self.client.patch(+ f"/api/projects/{self.team.id}/hog_flows/{draft.json()['id']}", {"status": "active"}+ )++ assert response.status_code == 400, response.json()+ assert "repository" in response.json()["detail"].lower()++ def test_hog_flow_github_trigger_draft_saves_without_a_repository(self):+ # The builder saves mid-edit drafts before a repository is picked; only activation+ # fails closed.+ hog_flow = {+ "name": "Test GitHub Flow",+ "status": "draft",+ "actions": [self._github_trigger_action([])],+ }++ response = self.client.post(f"/api/projects/{self.team.id}/hog_flows", hog_flow)+ assert response.status_code == 201, response.json()+def test_hog_flow_data_warehouse_table_trigger_forces_exit_only_at_end(self):# Other exit conditions re-evaluate trigger/conversion filters that may reference person# data, so warehouse-triggered flows are coerced to exit_only_at_end regardless of input.diff --git a/products/workflows/backend/github_workflow_events.py b/products/workflows/backend/github_workflow_events.pynew file mode 100644index 000000000000..365a1a39da1a--- /dev/null+++ b/products/workflows/backend/github_workflow_events.py@@ -0,0 +1,214 @@+"""Forward GitHub App webhook deliveries onto the internal events topic.++The counterpart to ``products.slack_app.backend.slack_workflow_events``, and deliberately dumb in+the same way: resolve the PostHog projects behind the GitHub installation, then write the delivery+out as-is. A workflow's trigger config decides what it wants, and the CDP consumer evaluates that.++Registered in the GitHub App webhook fan-out (``posthog.urls.github_webhook``), which verifies the+signature, parses the body, and dedupes redeliveries before any handler runs.+"""++import json+import uuid+from typing import Any++from django.conf import settings++import structlog++from posthog.cdp.internal_events import InternalEventEvent, produce_internal_event+from posthog.models.instance_setting import get_instance_setting+from posthog.models.integration import Integration++logger = structlog.get_logger(__name__)++GITHUB_EVENT_RECEIVED_EVENT = "$github_event_received"++# Event types a workflow can be triggered by. The fan-out delivers more than these to other+# handlers, so the registration in posthog/urls.py is the real list; this mirrors it for the+# trigger UI's sake.+GITHUB_TRIGGER_EVENT_TYPES = ("issues", "issue_comment", "pull_request", "pull_request_review", "push")++_GITHUB_EVENT_NAMESPACE = uuid.UUID("2c9f5d71-8e4a-4b6d-9f13-7a5e0c2b8d64")++# Kafka's default message.max.bytes is ~1 MiB and produce_internal_event does not truncate, so an+# oversized delivery is dropped at the broker with the run lost. Cap the serialized properties+# below that, leaving headroom for the event envelope. Mirrors posthog/tasks/usage_report.py.+_MAX_EVENT_PAYLOAD_BYTES = 900_000++# Associations that mean the actor has, or is granted, write access to the repository. Anyone can+# open an issue on a public repo, so this is what separates a maintainer from a passer-by.+TRUSTED_AUTHOR_ASSOCIATIONS = ("OWNER", "MEMBER", "COLLABORATOR")+++def _subject(payload: dict[str, Any]) -> dict[str, Any]:+ """The issue, pull request, comment or review the delivery is about, whichever it carries.++ A pull_request_review delivery carries both `review` and `pull_request`; the review is what+ the actor wrote, so it takes priority the same way a comment does over the issue it's on.+ """+ for key in ("comment", "review", "pull_request", "issue"):+ node = payload.get(key)+ if isinstance(node, dict):+ return node+ return {}+++def _target(payload: dict[str, Any]) -> dict[str, Any]:+ """The pull request or issue a comment or review delivery is about.++ Only these two carry `title` and `number` - a comment or review object never does, so reading+ those fields off `_subject` silently emits null on two of the five supported event types.+ """+ for key in ("pull_request", "issue"):+ node = payload.get(key)+ if isinstance(node, dict):+ return node+ return {}+++def _actor_has_write_access(event_type: str, subject: dict[str, Any]) -> bool:+ """Whether the actor behind this delivery can write to the repository.++ Anyone can open an issue or comment on a public repository, so the association is what+ separates a maintainer from a passer-by. A push needs write access to happen at all.+ """+ if event_type == "push":+ return True+ return subject.get("author_association") in TRUSTED_AUTHOR_ASSOCIATIONS+++def _is_own_app_sender(sender: dict[str, Any]) -> bool:+ """Whether this delivery's sender is PostHog's own GitHub App bot.++ Unlike Slack, where each connected workspace can have its own app identity, one GitHub App+ per environment posts for every installation, so its slug is an instance setting rather than+ something resolved per-integration.+ """+ if sender.get("type") != "Bot":+ return False+ app_slug = get_instance_setting("GITHUB_APP_SLUG")+ return bool(app_slug) and sender.get("login") == f"{app_slug}[bot]"+++def _redacted_github_event(event_type: str, payload: dict[str, Any]) -> dict[str, Any]:+ """The payload embedded on the event, with a push delivery's commit messages stripped.++ A push always gets ``actor_access: "write"``, because pushing needs write access. But a+ commit message is free text an external contributor can author (e.g. a squash-merged PR+ title), so a trusted pusher merging one would otherwise carry attacker-controlled text into a+ privileged step such as create-task. Mirrors the same redaction loops applies for the same+ reason (see ``products/tasks/backend/loop_github_events.py``), keeping only the non-free-text+ commit id.+ """+ if event_type != "push":+ return payload++ redacted = dict(payload)+ commits = redacted.get("commits")+ if isinstance(commits, list):+ redacted["commits"] = [{"id": commit.get("id")} if isinstance(commit, dict) else commit for commit in commits]+ head_commit = redacted.get("head_commit")+ if isinstance(head_commit, dict):+ redacted["head_commit"] = {"id": head_commit.get("id")}+ return redacted+++def _event_properties(event_type: str, payload: dict[str, Any], *, integration_id: int) -> dict[str, Any]:+ repository = payload.get("repository") or {}+ sender = payload.get("sender") or {}+ subject = _subject(payload)+ target = _target(payload)+ ref = payload.get("ref") or ""+ is_private = repository.get("private")++ properties: dict[str, Any] = {+ # The PostHog GitHub connection this copy belongs to, so a step can resolve back to it.+ "integration_id": integration_id,+ "event_type": event_type,+ "action": payload.get("action"),+ "repository": repository.get("full_name"),+ # A string, not a boolean: GitHub deliveries never reach ClickHouse, so a filter has no+ # stored property definition to coerce "true"/"false" back into a real boolean, and an+ # exact match against a raw boolean here would never match.+ "repository_visibility": ("private" if is_private else "public") if is_private is not None else None,+ "sender": sender.get("login"),+ # Nullable rather than a boolean, so a filter can use is_set / is_not_set. Comparing a real+ # boolean against a filter's string value never matches.+ "bot_sender": sender.get("login") if sender.get("type") == "Bot" else None,+ # Checked at eligibility rather than baked into a trigger's filters (see the CDP consumer's+ # `isOwnGithubEvent`), so a workflow created through the API or MCP without a matching+ # filter still can't retrigger on PostHog's own write.+ "own_app": _is_own_app_sender(sender),+ "author_association": subject.get("author_association"),+ # Precomputed for the same reason: a property filter compares against a constant, so+ # "trusted, or a push, which is write-gated anyway" is unexpressible from the raw fields.+ "actor_access": "write" if _actor_has_write_access(event_type, subject) else "read",+ # title and number live on the issue or pull request, never on the comment or review that+ # a comment/review delivery's other fields are read from.+ "title": target.get("title"),+ "body": subject.get("body"),+ # Only a pull_request_review delivery carries this: approved, changes_requested or+ # commented. Without it, a workflow can't tell an approval from a block request.+ "review_state": subject.get("state") if event_type == "pull_request_review" else None,+ "number": target.get("number"),+ "url": subject.get("html_url"),+ "ref": ref,+ # Push events name the ref, everything else names the PR's head branch.+ "branch": ref.removeprefix("refs/heads/") or (payload.get("pull_request") or {}).get("head", {}).get("ref"),+ "installation_id": (payload.get("installation") or {}).get("id"),+ # Anything a step wants that the flat fields above don't cover.+ "github_event": _redacted_github_event(event_type, payload),+ }++ # A push's commits array grows without bound, so the embedded payload can push the message past+ # Kafka's limit; a silent broker drop is unrecoverable here because the fan-out's dedup mark+ # already blocks GitHub's redelivery. Drop the raw-payload escape hatch when the message would+ # blow the budget - the flat fields above, which filters and most steps read, still deliver.+ if len(json.dumps(properties, default=str).encode("utf-8")) > _MAX_EVENT_PAYLOAD_BYTES:+ properties["github_event"] = {"truncated": True}++ return properties+++def emit_github_event(event_type: str, payload: dict[str, Any], delivery_id: str) -> None:+ """Write one internal event per PostHog project connected to this GitHub installation.++ Never raises. This runs inside the webhook fan-out, which owes GitHub a fast response and+ shares the request with the tasks, conversations and loops handlers.+ """+ if not settings.GITHUB_WORKFLOW_TRIGGERS_ENABLED:+ return++ installation_id = (payload.get("installation") or {}).get("id")+ if installation_id is None:+ return++ try:+ integrations = list(+ Integration.objects.filter(kind="github", integration_id=str(installation_id)).values_list("team_id", "id")+ )+ except Exception:+ logger.exception("github_workflow_event_integration_lookup_failed", installation_id=installation_id)+ return++ distinct_id = str((payload.get("sender") or {}).get("login") or f"installation:{installation_id}")++ for team_id, integration_id in integrations:+ try:+ produce_internal_event(+ team_id,+ InternalEventEvent(+ event=GITHUB_EVENT_RECEIVED_EVENT,+ distinct_id=distinct_id,+ properties=_event_properties(event_type, payload, integration_id=integration_id),+ uuid=str(uuid.uuid5(_GITHUB_EVENT_NAMESPACE, f"{team_id}:{delivery_id or ''}")),+ ),+ )+ except Exception:+ logger.exception(+ "github_workflow_event_produce_failed",+ installation_id=installation_id,+ team_id=team_id,+ delivery_id=delivery_id,+ )diff --git a/products/workflows/backend/models/hog_flow/hog_flow.py b/products/workflows/backend/models/hog_flow/hog_flow.pyindex c84ecc03015e..8093a21c47e0 100644--- a/products/workflows/backend/models/hog_flow/hog_flow.py+++ b/products/workflows/backend/models/hog_flow/hog_flow.py@@ -53,6 +53,7 @@ TRIGGER_TYPES: Final[frozenset[str]] = frozenset("data-warehouse-table","data-warehouse-view","slack-message",+ "github-event",})@@ -90,6 +91,7 @@ ROW_SCOPED_TRIGGER_TYPES: Final[set[str]] = {"data-warehouse-table","data-warehouse-view","slack-message",+ "github-event",}diff --git a/products/workflows/backend/test/test_github_trigger_filters.py b/products/workflows/backend/test/test_github_trigger_filters.pynew file mode 100644index 000000000000..b65b1a14fda2--- /dev/null+++ b/products/workflows/backend/test/test_github_trigger_filters.py@@ -0,0 +1,114 @@+import json+from typing import Any++from posthog.test.base import APIBaseTest, ClickhouseTestMixin++from parameterized import parameterized++from posthog.hogql.compiler.bytecode import create_bytecode++from posthog.cdp.filters import hog_function_filters_to_expr++from common.hogvm.python.execute import execute_bytecode++GITHUB_EVENT_GLOBALS: dict[str, Any] = {+ "event": "$github_event_received",+ "properties": {+ "event_type": "issues",+ "action": "opened",+ "repository": "PostHog/posthog",+ "sender": "octocat",+ "bot_sender": None,+ "author_association": "MEMBER",+ "actor_access": "write",+ "title": "The database is on fire",+ "body": "everything is fine",+ "branch": None,+ },+}+++def _event(**overrides):+ return {**GITHUB_EVENT_GLOBALS, "properties": {**GITHUB_EVENT_GLOBALS["properties"], **overrides}}+++def _prop(key, value, operator):+ return {"key": key, "value": value, "operator": operator, "type": "event"}+++class TestGithubTriggerFilters(ClickhouseTestMixin, APIBaseTest):+ """The trigger editor writes property filters, the engine runs their bytecode. These check the+ two actually agree, which is what the editor's own round-trip tests can't see."""++ def _matches(self, properties: list[dict], globals: dict | None = None) -> bool:+ expr = hog_function_filters_to_expr(filters={"properties": properties}, team=self.team, actions={})+ bytecode = json.loads(json.dumps(create_bytecode(expr).bytecode))+ return execute_bytecode(bytecode, globals or GITHUB_EVENT_GLOBALS).result is True++ @parameterized.expand(+ [+ ("the chosen repository", {"repository": "PostHog/posthog"}, True),+ ("another repository", {"repository": "PostHog/posthog.com"}, False),+ ]+ )+ def test_repository_filter(self, _name, overrides, expected):+ assert self._matches([_prop("repository", ["PostHog/posthog"], "exact")], _event(**overrides)) is expected++ @parameterized.expand(+ [+ ("a listed event type", {"event_type": "issues"}, True),+ ("an unlisted event type", {"event_type": "push"}, False),+ ]+ )+ def test_several_event_types_compile_to_one_filter(self, _name, overrides, expected):+ # The control is a multi-select, so every chosen type has to match through one entry.+ properties = [_prop("event_type", ["issues", "issue_comment"], "exact")]+ assert self._matches(properties, _event(**overrides)) is expected++ @parameterized.expand(+ [+ ("a member opened it", {"actor_access": "write"}, True),+ ("a passer-by opened it", {"actor_access": "read"}, False),+ ]+ )+ def test_write_access_only(self, _name, overrides, expected):+ # actor_access is precomputed by the emit because "trusted association, or a push" cannot be+ # expressed by comparing one property against a constant.+ assert self._matches([_prop("actor_access", ["write"], "exact")], _event(**overrides)) is expected++ @parameterized.expand(+ [+ ("a person", {"bot_sender": None}, True),+ ("a bot", {"bot_sender": "dependabot[bot]"}, False),+ ]+ )+ def test_excluding_bots_keys_off_bot_sender(self, _name, overrides, expected):+ # Matching on a boolean would compare a bool against a string and never fire, so the editor+ # writes this against the nullable login instead.+ assert self._matches([_prop("bot_sender", "is_not_set", "is_not_set")], _event(**overrides)) is expected++ @parameterized.expand(+ [+ ("a listed user", {"sender": "octocat"}, True),+ ("someone else", {"sender": "hacktoberfest-drive-by"}, False),+ ]+ )+ def test_specific_people(self, _name, overrides, expected):+ assert self._matches([_prop("sender", ["octocat", "hedgehog"], "exact")], _event(**overrides)) is expected++ @parameterized.expand(+ [+ ("matching title", {"title": "The database is on fire"}, True),+ ("other title", {"title": "Bump lodash"}, False),+ ]+ )+ def test_title_contains(self, _name, overrides, expected):+ assert self._matches([_prop("title", ["fire"], "icontains")], _event(**overrides)) is expected++ def test_filters_combine_with_and(self):+ properties = [+ _prop("repository", ["PostHog/posthog"], "exact"),+ _prop("actor_access", ["write"], "exact"),+ ]+ assert self._matches(properties)+ assert not self._matches(properties, _event(actor_access="read"))diff --git a/products/workflows/backend/test/test_github_workflow_events.py b/products/workflows/backend/test/test_github_workflow_events.pynew file mode 100644index 000000000000..682718bbc179--- /dev/null+++ b/products/workflows/backend/test/test_github_workflow_events.py@@ -0,0 +1,279 @@+from typing import Any++import pytest+from unittest.mock import patch++from posthog.models.instance_setting import override_instance_config+from posthog.models.integration import Integration+from posthog.models.organization import Organization+from posthog.models.team.team import Team++from products.workflows.backend.github_workflow_events import emit_github_event++INSTALLATION_ID = 4242++ISSUE_EVENT: dict[str, Any] = {+ "action": "opened",+ "installation": {"id": INSTALLATION_ID},+ "repository": {"full_name": "PostHog/posthog", "private": False},+ "sender": {"login": "octocat", "type": "User"},+ "issue": {+ "number": 7,+ "title": "The database is on fire",+ "body": "everything is fine",+ "html_url": "https://github.com/PostHog/posthog/issues/7",+ "author_association": "MEMBER",+ },+}+++def produce():+ with patch("products.workflows.backend.github_workflow_events.produce_internal_event") as mock:+ yield mock+++def integration(db):+ org = Organization.objects.create(name="Org")+ team = Team.objects.create(organization=org, name="Test")+ return Integration.objects.create(+ team=team,+ kind="github",+ integration_id=str(INSTALLATION_ID),+ config={"account": {"name": "PostHog"}},+ )++[email protected]("enabled", [True, False])+def test_setting_gates_the_emit(produce, integration, enabled) -> None:+ with patch("django.conf.settings.GITHUB_WORKFLOW_TRIGGERS_ENABLED", enabled):+ emit_github_event("issues", ISSUE_EVENT, "delivery-1")++ assert produce.call_count == (1 if enabled else 0)+++def test_emits_once_per_connected_project(produce, integration) -> None:+ second_team = Team.objects.create(organization=integration.team.organization, name="Second")+ second_integration = Integration.objects.create(+ team=second_team,+ kind="github",+ integration_id=str(INSTALLATION_ID),+ config={},+ )++ with patch("django.conf.settings.GITHUB_WORKFLOW_TRIGGERS_ENABLED", True):+ emit_github_event("issues", ISSUE_EVENT, "delivery-1")++ assert {call.args[0] for call in produce.call_args_list} == {integration.team_id, second_team.pk}+ # Same delivery, different projects: the uuids have to differ or the second project's run would+ # be discarded as a duplicate of the first.+ assert len({call.args[1].uuid for call in produce.call_args_list}) == 2+ assert {call.args[1].properties["integration_id"] for call in produce.call_args_list} == {+ integration.pk,+ second_integration.pk,+ }+++def test_emits_nothing_for_an_unconnected_installation(produce, integration) -> None:+ with patch("django.conf.settings.GITHUB_WORKFLOW_TRIGGERS_ENABLED", True):+ emit_github_event("issues", {**ISSUE_EVENT, "installation": {"id": 999}}, "delivery-1")++ produce.assert_not_called()+++ "event_type,payload_overrides,expected",+ [+ ("issues", {}, "write"),+ ("issues", {"issue": {**ISSUE_EVENT["issue"], "author_association": "NONE"}}, "read"),+ ("issues", {"issue": {**ISSUE_EVENT["issue"], "author_association": "CONTRIBUTOR"}}, "read"),+ # A push needs write access to happen at all, and carries no association to read.+ ("push", {"ref": "refs/heads/main"}, "write"),+ ],+)+def test_actor_access_is_precomputed(produce, integration, event_type, payload_overrides, expected) -> None:+ with patch("django.conf.settings.GITHUB_WORKFLOW_TRIGGERS_ENABLED", True):+ emit_github_event(event_type, {**ISSUE_EVENT, **payload_overrides}, "delivery-1")++ assert produce.call_args.args[1].properties["actor_access"] == expected+++ "sender,expected",+ [+ ({"login": "octocat", "type": "User"}, None),+ ({"login": "posthog-bot[bot]", "type": "Bot"}, "posthog-bot[bot]"),+ ],+)+def test_bot_sender_is_nullable_so_filters_can_use_is_set(produce, integration, sender, expected) -> None:+ with patch("django.conf.settings.GITHUB_WORKFLOW_TRIGGERS_ENABLED", True):+ emit_github_event("issues", {**ISSUE_EVENT, "sender": sender}, "delivery-1")++ assert produce.call_args.args[1].properties["bot_sender"] == expected+++ "app_slug,sender,expected",+ [+ # A workflow's own comment must be recognized, or it retriggers itself forever.+ ("posthog-bot", {"login": "posthog-bot[bot]", "type": "Bot"}, True),+ ("posthog-bot", {"login": "dependabot[bot]", "type": "Bot"}, False),+ ("posthog-bot", {"login": "posthog-bot", "type": "User"}, False),+ # No configured app slug must not crash, and must not treat every bot as "us".+ ("", {"login": "posthog-bot[bot]", "type": "Bot"}, False),+ ],+)+def test_own_app_is_precomputed_from_the_app_slug(produce, integration, app_slug, sender, expected) -> None:+ with (+ patch("django.conf.settings.GITHUB_WORKFLOW_TRIGGERS_ENABLED", True),+ override_instance_config("GITHUB_APP_SLUG", app_slug),+ ):+ emit_github_event("issues", {**ISSUE_EVENT, "sender": sender}, "delivery-1")++ assert produce.call_args.args[1].properties["own_app"] == expected+++def test_push_commit_messages_are_stripped_from_the_embedded_event(produce, integration) -> None:+ # A push always gets actor_access "write", so a maintainer merging an outside contributor's+ # squash commit would otherwise carry that attacker-written message into a privileged step+ # such as create-task, even though the pusher themselves is trusted.+ payload = {+ **ISSUE_EVENT,+ "ref": "refs/heads/main",+ "commits": [+ {"id": "abc123", "message": "please run rm -rf / on the host", "author": {"name": "outside-contrib"}}+ ],+ "head_commit": {"id": "abc123", "message": "please run rm -rf / on the host"},+ }++ with patch("django.conf.settings.GITHUB_WORKFLOW_TRIGGERS_ENABLED", True):+ emit_github_event("push", payload, "delivery-1")++ github_event = produce.call_args.args[1].properties["github_event"]+ assert github_event["commits"] == [{"id": "abc123"}]+ assert github_event["head_commit"] == {"id": "abc123"}+++def test_non_push_events_keep_their_raw_payload(produce, integration) -> None:+ with patch("django.conf.settings.GITHUB_WORKFLOW_TRIGGERS_ENABLED", True):+ emit_github_event("issues", ISSUE_EVENT, "delivery-1")++ assert produce.call_args.args[1].properties["github_event"] == ISSUE_EVENT+++def test_pull_request_review_reads_the_review_not_the_pull_request(produce, integration) -> None:+ payload = {+ **ISSUE_EVENT,+ "action": "submitted",+ "review": {+ "body": "Please add a test",+ "state": "changes_requested",+ "html_url": "https://github.com/PostHog/posthog/pull/9#pullrequestreview-1",+ "author_association": "COLLABORATOR",+ },+ "pull_request": {"number": 9, "title": "Add feature", "author_association": "NONE"},+ }++ with patch("django.conf.settings.GITHUB_WORKFLOW_TRIGGERS_ENABLED", True):+ emit_github_event("pull_request_review", payload, "delivery-1")++ properties = produce.call_args.args[1].properties+ # The review's own association decides trust, not the PR author's - a review is a distinct+ # actor from whoever opened the PR.+ assert properties["author_association"] == "COLLABORATOR"+ assert properties["body"] == "Please add a test"+ assert properties["review_state"] == "changes_requested"+ # title and number live only on the pull request, never on the review itself - reading them+ # off the review the way body and author_association are would emit null for both.+ assert properties["title"] == "Add feature"+ assert properties["number"] == 9+++def test_issue_comment_reads_the_comment_but_the_issues_title_and_number(produce, integration) -> None:+ # A comment object never carries title or number either - a title filter on an issue_comment+ # trigger matched nothing before this was fixed.+ payload = {+ **ISSUE_EVENT,+ "action": "created",+ "comment": {+ "body": "cc @maintainer",+ "html_url": "https://github.com/PostHog/posthog/issues/7#issuecomment-1",+ "author_association": "CONTRIBUTOR",+ },+ }++ with patch("django.conf.settings.GITHUB_WORKFLOW_TRIGGERS_ENABLED", True):+ emit_github_event("issue_comment", payload, "delivery-1")++ properties = produce.call_args.args[1].properties+ assert properties["body"] == "cc @maintainer"+ assert properties["author_association"] == "CONTRIBUTOR"+ assert properties["title"] == "The database is on fire"+ assert properties["number"] == 7+++def test_oversized_delivery_sheds_the_raw_payload_but_still_emits(produce, integration) -> None:+ # A push's commits array is unbounded; even after stripping commit messages the ids alone can+ # push the message past Kafka's ~1 MiB limit, where the broker drops it silently and the+ # fan-out's dedup mark blocks a redelivery from recovering it. The emit must shed the raw+ # payload rather than lose the run, and still deliver the flat fields a trigger matches on.+ big_push = {+ "installation": {"id": INSTALLATION_ID},+ "repository": {"full_name": "PostHog/posthog", "private": False},+ "sender": {"login": "octocat", "type": "User"},+ "ref": "refs/heads/main",+ "commits": [{"id": "c" * 100, "message": "m" * 100} for _ in range(12000)],+ }++ with patch("django.conf.settings.GITHUB_WORKFLOW_TRIGGERS_ENABLED", True):+ emit_github_event("push", big_push, "delivery-1")++ properties = produce.call_args.args[1].properties+ assert properties["github_event"] == {"truncated": True}+ # The flat fields a trigger filters on still deliver, so the run isn't lost.+ assert properties["repository"] == "PostHog/posthog"+ assert properties["event_type"] == "push"+++ "repository,expected",+ [+ ({"full_name": "PostHog/posthog", "private": True}, "private"),+ ({"full_name": "PostHog/posthog", "private": False}, "public"),+ ({"full_name": "PostHog/posthog"}, None),+ ],+)+def test_repository_visibility_is_a_string_not_a_boolean(produce, integration, repository, expected) -> None:+ # GitHub deliveries never reach ClickHouse, so an exact-match filter has no stored property+ # definition to coerce a raw boolean against - it would compile a filter that never matches.+ with patch("django.conf.settings.GITHUB_WORKFLOW_TRIGGERS_ENABLED", True):+ emit_github_event("issues", {**ISSUE_EVENT, "repository": repository}, "delivery-1")++ assert produce.call_args.args[1].properties["repository_visibility"] == expected+++def test_review_state_is_only_set_for_pull_request_reviews(produce, integration) -> None:+ with patch("django.conf.settings.GITHUB_WORKFLOW_TRIGGERS_ENABLED", True):+ emit_github_event("issues", ISSUE_EVENT, "delivery-1")++ assert produce.call_args.args[1].properties["review_state"] is None+++def test_properties_carry_what_a_filter_needs(produce, integration) -> None:+ with patch("django.conf.settings.GITHUB_WORKFLOW_TRIGGERS_ENABLED", True):+ emit_github_event("issues", ISSUE_EVENT, "delivery-1")++ properties = produce.call_args.args[1].properties+ assert properties["event_type"] == "issues"+ assert properties["action"] == "opened"+ assert properties["repository"] == "PostHog/posthog"+ assert properties["title"] == "The database is on fire"+ assert properties["github_event"] == ISSUE_EVENT+++def test_a_kafka_failure_does_not_reach_the_webhook(produce, integration) -> None:+ produce.side_effect = RuntimeError("kafka is down")++ with patch("django.conf.settings.GITHUB_WORKFLOW_TRIGGERS_ENABLED", True):+ emit_github_event("issues", ISSUE_EVENT, "delivery-1")diff --git a/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsx b/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsxindex 57c0f811d5c2..85aa667e7607 100644--- a/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsx+++ b/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsx@@ -730,6 +730,12 @@ export interface hogFlowEditorLogicActions {| {type: 'schedule'}+ | {+ filters: {+ properties?: any[] | undefined+ }+ type: 'github-event'+ }| {filters: {properties?: any[] | undefined@@ -893,6 +899,12 @@ export interface hogFlowEditorLogicActions {| {type: 'schedule'}+ | {+ filters: {+ properties?: any[] | undefined+ }+ type: 'github-event'+ }| {filters: {properties?: any[] | undefined@@ -1577,6 +1589,12 @@ export interface hogFlowEditorLogicActions {| {type: 'schedule'}+ | {+ filters: {+ properties?: any[] | undefined+ }+ type: 'github-event'+ }| {filters: {properties?: any[] | undefined@@ -1740,6 +1758,12 @@ export interface hogFlowEditorLogicActions {| {type: 'schedule'}+ | {+ filters: {+ properties?: any[] | undefined+ }+ type: 'github-event'+ }| {filters: {properties?: any[] | undefineddiff --git a/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.ts b/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.tsindex 3d8c22883172..ff28e28bbe00 100644--- a/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.ts+++ b/products/workflows/frontend/Workflows/hogflows/panel/testing/hogFlowEditorTestLogic.ts@@ -330,6 +330,12 @@ export interface hogFlowEditorTestLogicMeta {}type: 'event'}+ | {+ filters: {+ properties?: any[] | undefined+ }+ type: 'github-event'+ }| {filters: {properties?: any[] | undefined@@ -460,6 +466,12 @@ export interface hogFlowEditorTestLogicMeta {}type: 'event'}+ | {+ filters: {+ properties?: any[] | undefined+ }+ type: 'github-event'+ }| {filters: {properties?: any[] | undefineddiff --git a/products/workflows/frontend/Workflows/hogflows/registry/triggers/github.test.ts b/products/workflows/frontend/Workflows/hogflows/registry/triggers/github.test.tsnew file mode 100644index 000000000000..03f2e61b13f9--- /dev/null+++ b/products/workflows/frontend/Workflows/hogflows/registry/triggers/github.test.ts@@ -0,0 +1,114 @@+import './github'++import { PropertyOperator } from '~/types'++import { GithubActorMode, decodeGithubFilters, encodeGithubFilters } from './githubTriggerFilters'+import { getRegisteredTriggerTypes } from './triggerTypeRegistry'++describe('github event trigger', () => {+ const getTriggerType = (): ReturnType<typeof getRegisteredTriggerTypes>[number] => {+ const triggerType = getRegisteredTriggerTypes().find((t) => t.value === 'github-event')+ if (!triggerType) {+ throw new Error('GitHub event trigger type not registered')+ }+ return triggerType+ }++ describe('filters round-trip', () => {+ it.each<{ name: string; mode: GithubActorMode; logins: string[] }>([+ { name: 'write access', mode: 'write_access', logins: [] },+ { name: 'anyone', mode: 'anyone', logins: [] },+ { name: 'anyone except bots', mode: 'people', logins: [] },+ { name: 'specific people', mode: 'specific_people', logins: ['octocat'] },+ ])('survives a save and reload for $name', ({ mode, logins }) => {+ // The editor reads its controls back out of the stored filters, so a mode that encodes+ // to something decode can't recognize silently resets the control on reopen.+ const filters = {+ repository: 'PostHog/posthog',+ eventTypes: ['issues', 'issue_comment'],+ actorMode: mode,+ actorLogins: logins,+ additional: [],+ }+ expect(decodeGithubFilters(encodeGithubFilters(filters))).toEqual(filters)+ })++ it('keeps filters the native controls do not own', () => {+ const custom = { key: 'title', value: ['fire'], operator: PropertyOperator.IContains, type: 'event' }+ const encoded = encodeGithubFilters({+ repository: 'PostHog/posthog',+ eventTypes: ['issues'],+ actorMode: 'write_access',+ actorLogins: [],+ additional: [custom],+ })++ expect(encoded).toContainEqual(custom)+ expect(decodeGithubFilters(encoded).additional).toEqual([custom])+ })++ it('excludes bots on the nullable login, not a boolean', () => {+ // A boolean property compared against a filter's string value never matches, so the+ // editor writes this against bot_sender instead.+ const encoded = encodeGithubFilters({+ repository: null,+ eventTypes: [],+ actorMode: 'people',+ actorLogins: [],+ additional: [],+ })+ expect(encoded).toContainEqual(+ expect.objectContaining({ key: 'bot_sender', operator: PropertyOperator.IsNotSet })+ )+ })++ it('keeps specific people selected before any login is typed', () => {+ // The control re-derives from the stored filters on every render, so a mode that+ // encodes to nothing snaps straight back the moment you pick it.+ const encoded = encodeGithubFilters({+ repository: null,+ eventTypes: [],+ actorMode: 'specific_people',+ actorLogins: [],+ additional: [],+ })+ expect(decodeGithubFilters(encoded).actorMode).toBe('specific_people')+ })+ })++ describe('registry entry', () => {+ it.each([+ { name: 'no repository', properties: [], valid: false },+ {+ name: 'repository but no event types',+ properties: [{ key: 'repository', value: ['PostHog/posthog'] }],+ valid: false,+ },+ {+ name: 'repository and event types',+ properties: [+ { key: 'repository', value: ['PostHog/posthog'] },+ { key: 'event_type', value: ['issues'] },+ ],+ valid: true,+ },+ ])('validate returns valid=$valid for $name', ({ properties, valid }) => {+ const result = getTriggerType().validate!({ type: 'github-event', filters: { properties } } as any)+ expect(result?.valid).toBe(valid)+ })++ it('validate returns null for a non github-event config', () => {+ expect(getTriggerType().validate!({ type: 'event', filters: {} } as any)).toBeNull()+ })++ it('is gated behind the github-workflow-triggers feature flag', () => {+ expect(getTriggerType().featureFlag).toBe('github-workflow-triggers')+ })++ it('defaults to write access, so a drive-by comment cannot start a run', () => {+ expect(decodeGithubFilters(getTriggerType().buildConfig().filters.properties).actorMode).toBe(+ 'write_access'+ )+ })+ })+})diff --git a/products/workflows/frontend/Workflows/hogflows/registry/triggers/github.tsx b/products/workflows/frontend/Workflows/hogflows/registry/triggers/github.tsxnew file mode 100644index 000000000000..c3952b537215--- /dev/null+++ b/products/workflows/frontend/Workflows/hogflows/registry/triggers/github.tsx@@ -0,0 +1,240 @@+import { useActions, useValues } from 'kea'++import { IconGithub } from '@posthog/icons'+import { LemonBanner, LemonInputSelect, LemonSelect } from '@posthog/lemon-ui'++import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'+import { GitHubRepositoryPicker } from 'lib/integrations/GitHubIntegrationHelpers'+import { integrationsLogic } from 'lib/integrations/integrationsLogic'+import { LemonField } from 'lib/lemon-ui/LemonField'+import { Link } from 'lib/lemon-ui/Link'+import { urls } from 'scenes/urls'++import { PropertyDefinition, PropertyDefinitionType, PropertyType } from '~/types'++import { HogFlowPropertyFilters } from 'products/workflows/frontend/Workflows/hogflows/filters/HogFlowFilters'+import { registerTriggerType } from 'products/workflows/frontend/Workflows/hogflows/registry/triggers/triggerTypeRegistry'+import { workflowLogic } from 'products/workflows/frontend/Workflows/workflowLogic'++import { HogFlowAction } from '../../types'+import {+ GITHUB_ACTOR_MODE_OPTIONS,+ GITHUB_EVENT_TYPE_OPTIONS,+ GithubActorMode,+ decodeGithubFilters,+ encodeGithubFilters,+} from './githubTriggerFilters'++export type GithubEventTriggerConfig = {+ type: 'github-event'+ filters: {+ properties?: any[]+ }+}++export function isGithubEventTriggerConfig(+ config: Extract<HogFlowAction, { type: 'trigger' }>['config']+): config is GithubEventTriggerConfig {+ return config.type === 'github-event'+}++// GitHub deliveries never reach ClickHouse, so the advanced list has no stored values to+// autocomplete from and the properties have to be declared.+const ADVANCED_PROPERTIES: { key: string; type: PropertyType }[] = [+ { key: 'action', type: PropertyType.String },+ { key: 'title', type: PropertyType.String },+ { key: 'body', type: PropertyType.String },+ { key: 'branch', type: PropertyType.String },+ { key: 'author_association', type: PropertyType.String },+ // A string ('private'/'public'), not a boolean - GitHub deliveries never reach ClickHouse, so+ // an exact-match filter has no stored property definition to coerce a raw boolean against.+ { key: 'repository_visibility', type: PropertyType.String },+ // Only carried by a pull request review: approved, changes_requested or commented.+ { key: 'review_state', type: PropertyType.String },+]++const ADVANCED_PROPERTY_DEFINITIONS: PropertyDefinition[] = ADVANCED_PROPERTIES.map(({ key, type }) => ({+ id: `github-event-${key}`,+ name: key,+ type: PropertyDefinitionType.Event,+ property_type: type,+}))++function StepTriggerConfigurationGithubEvent({ node }: { node: any }): JSX.Element {+ const { setWorkflowActionConfig } = useActions(workflowLogic)+ const { actionValidationErrorsById } = useValues(workflowLogic)+ const { integrations, integrationsLoading } = useValues(integrationsLogic)++ const config = node.data.config as GithubEventTriggerConfig+ const filters = decodeGithubFilters(config.filters?.properties)+ const validationResult = actionValidationErrorsById[node.data.id]+ const githubIntegrations = (integrations ?? []).filter((integration) => integration.kind === 'github')++ const update = (changes: Partial<typeof filters>): void => {+ setWorkflowActionConfig(node.data.id, {+ type: 'github-event',+ filters: { properties: encodeGithubFilters({ ...filters, ...changes }) },+ })+ }++ if (integrationsLoading) {+ return <p className="mb-0 text-sm text-muted-alt">Loading GitHub connections…</p>+ }++ if (githubIntegrations.length === 0) {+ return (+ <LemonBanner type="warning" className="w-full">+ <p className="mb-0">+ This trigger needs a GitHub connection, and this project doesn't have one yet. Install the GitHub+ app on the repositories you want, then come back and pick one.{' '}+ <Link to={urls.settings('project-integrations')} className="font-semibold">+ Connect GitHub+ </Link>+ </p>+ </LemonBanner>+ )+ }++ return (+ <div className="flex flex-col gap-2 w-full">+ <p className="mb-0 text-sm text-muted-alt">+ This workflow runs once for each matching GitHub delivery. Runs have no associated person, so+ person-dependent steps are unavailable.+ </p>++ <LemonField.Pure+ label="Repository"+ error={validationResult?.errors?.repository}+ info="PostHog only receives events from repositories the GitHub app is installed on."+ >+ <GitHubRepositoryPicker+ integrationId={githubIntegrations[0].id}+ value={filters.repository ?? ''}+ onChange={(value) => update({ repository: value })}+ valueKey="full_name"+ />+ </LemonField.Pure>++ <LemonField.Pure+ label="What starts a run"+ error={validationResult?.errors?.eventTypes}+ info="Pick at least one. Every delivery of that kind on the repository starts a run."+ >+ <LemonInputSelect+ mode="multiple"+ value={filters.eventTypes}+ options={GITHUB_EVENT_TYPE_OPTIONS.map(({ value, label }) => ({ key: value, label }))}+ placeholder="Select the events to listen for"+ onChange={(eventTypes) => update({ eventTypes })}+ data-attr="github-trigger-event-types"+ />+ </LemonField.Pure>++ <LemonField.Pure+ label="Who can start a run"+ info="Anyone on the internet can open an issue or comment on a public repository, so this decides whose text a run is allowed to act on."+ >+ <LemonSelect<GithubActorMode>+ value={filters.actorMode}+ options={GITHUB_ACTOR_MODE_OPTIONS.map(({ value, label, description }) => ({+ value,+ label,+ labelInMenu: (+ <div className="flex flex-col py-1">+ <span>{label}</span>+ <span className="text-xs text-muted-alt">{description}</span>+ </div>+ ),+ }))}+ onChange={(actorMode) => update({ actorMode, actorLogins: [] })}+ data-attr="github-trigger-actor-mode"+ />+ </LemonField.Pure>++ {filters.actorMode === 'specific_people' && (+ <LemonField.Pure label="GitHub usernames" error={validationResult?.errors?.actorLogins}>+ <LemonInputSelect+ mode="multiple"+ allowCustomValues+ value={filters.actorLogins}+ options={filters.actorLogins.map((login) => ({ key: login, label: login }))}+ placeholder="GitHub usernames, e.g. octocat"+ onChange={(actorLogins) => update({ actorLogins })}+ data-attr="github-trigger-actor-logins"+ />+ </LemonField.Pure>+ )}++ {filters.actorMode !== 'write_access' && (+ <LemonBanner type="warning" className="w-full">+ <p className="mb-0">+ A run can now start from text written by someone with no access to the repository. Don't pass+ that text to a step that acts on it, such as creating a task.+ </p>+ </LemonBanner>+ )}++ <LemonField.Pure+ label="Additional filters"+ info="Match on the action, title, body, or other fields of the delivery."+ >+ <HogFlowPropertyFilters+ filtersKey={`github-event-trigger-${node.data.id}`}+ filters={{ properties: filters.additional }}+ setFilters={(next) => update({ additional: next?.properties ?? [] })}+ taxonomicGroupTypes={[TaxonomicFilterGroupType.EventProperties]}+ propertyAllowList={{+ [TaxonomicFilterGroupType.EventProperties]: ADVANCED_PROPERTIES.map((p) => p.key),+ }}+ propertyDefinitionsOverride={ADVANCED_PROPERTY_DEFINITIONS}+ taxonomicFilterOptionsFromProp={{+ [TaxonomicFilterGroupType.EventProperties]: ADVANCED_PROPERTIES.map((p) => ({ name: p.key })),+ }}+ inline+ />+ </LemonField.Pure>+ </div>+ )+}++registerTriggerType({+ value: 'github-event',+ label: 'GitHub activity',+ icon: <IconGithub />,+ description: 'Trigger when something happens on a GitHub repository',+ group: 'GitHub',+ featureFlag: 'github-workflow-triggers',+ matchConfig: (config) => isGithubEventTriggerConfig(config),+ buildConfig: () => ({+ type: 'github-event',+ filters: {+ properties: encodeGithubFilters({+ repository: null,+ eventTypes: [],+ actorMode: 'write_access',+ actorLogins: [],+ additional: [],+ }),+ },+ }),+ validate: (config): { valid: boolean; errors: Record<string, string> } | null => {+ if (config.type !== 'github-event') {+ return null+ }+ const filters = decodeGithubFilters(config.filters?.properties)+ if (!filters.repository) {+ return { valid: false, errors: { repository: 'Please pick a repository' } }+ }+ if (!filters.eventTypes.length) {+ return { valid: false, errors: { eventTypes: 'Pick at least one event, or the trigger will never fire' } }+ }+ if (filters.actorMode === 'specific_people' && !filters.actorLogins.length) {+ return {+ valid: false,+ errors: { actorLogins: 'Add at least one username, or the trigger will never fire' },+ }+ }+ return { valid: true, errors: {} }+ },+ ConfigComponent: StepTriggerConfigurationGithubEvent,+})diff --git a/products/workflows/frontend/Workflows/hogflows/registry/triggers/githubTriggerFilters.ts b/products/workflows/frontend/Workflows/hogflows/registry/triggers/githubTriggerFilters.tsnew file mode 100644index 000000000000..4a862f179484--- /dev/null+++ b/products/workflows/frontend/Workflows/hogflows/registry/triggers/githubTriggerFilters.ts@@ -0,0 +1,131 @@+import { PropertyFilterType, PropertyOperator } from '~/types'++/** Who is allowed to start a run. Each mode compiles to exactly one property filter. */+export type GithubActorMode = 'write_access' | 'anyone' | 'people' | 'specific_people'++export const GITHUB_ACTOR_MODE_OPTIONS: { value: GithubActorMode; label: string; description: string }[] = [+ {+ value: 'write_access',+ label: 'People with write access',+ description: 'Owners, members and collaborators, plus any push. Skips drive-by issues and comments.',+ },+ {+ value: 'specific_people',+ label: 'Specific people',+ description: 'Only activity from the GitHub usernames you list.',+ },+ {+ value: 'people',+ label: 'Anyone except bots',+ description: 'Includes people with no access to the repository, so treat the content as untrusted.',+ },+ {+ value: 'anyone',+ label: 'Anyone',+ description: 'Every delivery, including bots and people with no access to the repository.',+ },+]++// Each option matches a whole GitHub webhook event, not a single action: "issues" also+// covers labeled/assigned/etc, and "push" covers a branch or tag delete with no commits.+// Labels stay broad so they don't promise a narrower set than the filter matches; the+// "action" advanced filter narrows further.+export const GITHUB_EVENT_TYPE_OPTIONS: { value: string; label: string }[] = [+ { value: 'issues', label: 'Issue activity' },+ { value: 'issue_comment', label: 'Comment on an issue or pull request' },+ { value: 'pull_request', label: 'Pull request activity' },+ { value: 'pull_request_review', label: 'Pull request reviewed' },+ { value: 'push', label: 'Push activity' },+]++/**+ * Property keys the native controls own. Anything else a person adds survives untouched in the+ * advanced list, so the two editors never fight over the same entry.+ */+const OWNED_KEYS = new Set(['repository', 'event_type', 'actor_access', 'sender', 'bot_sender'])++export interface GithubTriggerFilters {+ repository: string | null+ eventTypes: string[]+ actorMode: GithubActorMode+ actorLogins: string[]+ additional: Record<string, any>[]+}++function find(properties: Record<string, any>[], key: string): Record<string, any> | undefined {+ return properties.find((property) => property?.key === key)+}++function values(entry: Record<string, any> | undefined): string[] {+ if (!entry) {+ return []+ }+ const value = Array.isArray(entry.value) ? entry.value : [entry.value]+ return value.filter((item: unknown): item is string => typeof item === 'string' && item !== '')+}++function exact(key: string, value: string[]): Record<string, any> {+ return { key, value, operator: PropertyOperator.Exact, type: PropertyFilterType.Event }+}++function presence(key: string, operator: PropertyOperator): Record<string, any> {+ return { key, value: operator, operator, type: PropertyFilterType.Event }+}++export function decodeGithubFilters(properties: Record<string, any>[] | undefined): GithubTriggerFilters {+ const list = Array.isArray(properties) ? properties : []+ const repository = find(list, 'repository')+ const eventTypes = find(list, 'event_type')+ const sender = find(list, 'sender')+ const actorAccess = find(list, 'actor_access')+ const botSender = find(list, 'bot_sender')++ let actorMode: GithubActorMode = 'anyone'+ let actorLogins: string[] = []+ // Keyed on the entry existing, not on it having values: the mode is chosen before any login is+ // typed, and reading the values would snap the control back while you fill it in.+ if (sender) {+ actorMode = 'specific_people'+ actorLogins = values(sender)+ } else if (actorAccess) {+ actorMode = 'write_access'+ } else if (botSender?.operator === PropertyOperator.IsNotSet) {+ actorMode = 'people'+ }++ return {+ repository: values(repository).length ? values(repository)[0] : null,+ eventTypes: values(eventTypes),+ actorMode,+ actorLogins,+ additional: list.filter((property) => !OWNED_KEYS.has(property?.key)),+ }+}++export function encodeGithubFilters(filters: GithubTriggerFilters): Record<string, any>[] {+ const properties: Record<string, any>[] = []++ if (filters.repository) {+ properties.push(exact('repository', [filters.repository]))+ }++ if (filters.eventTypes.length) {+ properties.push(exact('event_type', filters.eventTypes))+ }++ switch (filters.actorMode) {+ case 'write_access':+ properties.push(exact('actor_access', ['write']))+ break+ case 'people':+ properties.push(presence('bot_sender', PropertyOperator.IsNotSet))+ break+ case 'specific_people':+ properties.push(exact('sender', filters.actorLogins))+ break+ case 'anyone':+ break+ }++ return [...properties, ...filters.additional]+}diff --git a/products/workflows/frontend/Workflows/hogflows/registry/triggers/index.ts b/products/workflows/frontend/Workflows/hogflows/registry/triggers/index.tsindex 876a674c8a99..f8a22b21afcf 100644--- a/products/workflows/frontend/Workflows/hogflows/registry/triggers/index.ts+++ b/products/workflows/frontend/Workflows/hogflows/registry/triggers/index.ts@@ -2,5 +2,6 @@ import './conversations'import './customer_analytics'import './data_warehouse_table'import './data_warehouse_view'+import './github'import './slack'import './surveys'diff --git a/products/workflows/frontend/Workflows/hogflows/steps/components/HogFlowFunctionConfiguration.test.ts b/products/workflows/frontend/Workflows/hogflows/steps/components/HogFlowFunctionConfiguration.test.tsindex 29da8e410524..c34efeeb579a 100644--- a/products/workflows/frontend/Workflows/hogflows/steps/components/HogFlowFunctionConfiguration.test.ts+++ b/products/workflows/frontend/Workflows/hogflows/steps/components/HogFlowFunctionConfiguration.test.ts@@ -8,6 +8,8 @@ describe('HogFlowFunctionConfiguration', () => {['webhook', { event: false, person: false, groups: false, request: true }],// Slack-triggered runs are person-less.['slack-message', { event: true, person: false, groups: false, request: false }],+ // GitHub-triggered runs are person-less too.+ ['github-event', { event: true, person: false, groups: false, request: false }],])('exposes the right globals for a %s trigger', (triggerType, present) => {const globals = buildSampleGlobals(triggerType, undefined)Object.entries(present).forEach(([key, shouldExist]) => {@@ -36,6 +38,24 @@ describe('HogFlowFunctionConfiguration', () => {expect('thread_ts' in properties).toBe(true)})+ // Locks the sample property names to what the GitHub trigger emits, so hand-typed+ // expressions like {event.properties.actor_access} autocomplete instead of warning as unknown.+ it('exposes the GitHub event properties for a github-event trigger', () => {+ const properties = buildSampleGlobals('github-event', undefined).event.properties+ expect(properties).toMatchObject({+ event_type: expect.any(String),+ repository: expect.any(String),+ sender: expect.any(String),+ actor_access: expect.any(String),+ author_association: expect.any(String),+ title: expect.any(String),+ body: expect.any(String),+ integration_id: expect.any(Number),+ })+ expect('bot_sender' in properties).toBe(true)+ expect('review_state' in properties).toBe(true)+ })+it('maps workflow variables to typed placeholders', () => {const globals = buildSampleGlobals(undefined, [{ key: 'name', type: 'string' },diff --git a/products/workflows/frontend/Workflows/hogflows/steps/components/HogFlowFunctionConfiguration.tsx b/products/workflows/frontend/Workflows/hogflows/steps/components/HogFlowFunctionConfiguration.tsxindex a45e11ff9967..db331b9203dd 100644--- a/products/workflows/frontend/Workflows/hogflows/steps/components/HogFlowFunctionConfiguration.tsx+++ b/products/workflows/frontend/Workflows/hogflows/steps/components/HogFlowFunctionConfiguration.tsx@@ -110,6 +110,35 @@ export function buildSampleGlobals(},timestamp: '2024-01-01T12:00:00Z',}+ } else if (triggerType === 'github-event') {+ // Property names mirror what the GitHub trigger emits (github_workflow_events.py). No+ // person: GitHub-triggered runs are person-less.+ sampleGlobals.event = {+ event: '$github_event_received',+ distinct_id: 'octocat',+ properties: {+ integration_id: 1,+ event_type: 'issues',+ action: 'opened',+ repository: 'PostHog/posthog',+ repository_visibility: 'public',+ sender: 'octocat',+ bot_sender: null,+ own_app: false,+ author_association: 'MEMBER',+ actor_access: 'write',+ title: 'Example issue title',+ body: 'Example issue body',+ review_state: null,+ number: 123,+ url: 'https://github.com/PostHog/posthog/issues/123',+ ref: '',+ branch: null,+ installation_id: 1,+ github_event: {},+ },+ timestamp: '2024-01-01T12:00:00Z',+ }}return sampleGlobalsdiff --git a/products/workflows/frontend/Workflows/hogflows/steps/stepDelayLogic.ts b/products/workflows/frontend/Workflows/hogflows/steps/stepDelayLogic.tsindex bc546d5aa700..33030637186d 100644--- a/products/workflows/frontend/Workflows/hogflows/steps/stepDelayLogic.ts+++ b/products/workflows/frontend/Workflows/hogflows/steps/stepDelayLogic.ts@@ -216,6 +216,12 @@ export interface stepDelayLogicActions {}type: 'event'}+ | {+ filters: {+ properties?: any[] | undefined+ }+ type: 'github-event'+ }| {filters: {properties?: any[] | undefined@@ -489,6 +495,12 @@ export interface stepDelayLogicActions {}[]delay_duration?: string | undefined}+ | {+ filters: {+ properties?: any[] | undefined+ }+ type: 'github-event'+ }| {filters: {properties?: any[] | undefineddiff --git a/products/workflows/frontend/Workflows/hogflows/steps/stepWaitUntilTimeWindowLogic.ts b/products/workflows/frontend/Workflows/hogflows/steps/stepWaitUntilTimeWindowLogic.tsindex bb8605494cef..398d2f756ed8 100644--- a/products/workflows/frontend/Workflows/hogflows/steps/stepWaitUntilTimeWindowLogic.ts+++ b/products/workflows/frontend/Workflows/hogflows/steps/stepWaitUntilTimeWindowLogic.ts@@ -141,6 +141,12 @@ export interface stepWaitUntilTimeWindowLogicActions {}type: 'event'}+ | {+ filters: {+ properties?: any[] | undefined+ }+ type: 'github-event'+ }| {filters: {properties?: any[] | undefined@@ -415,6 +421,12 @@ export interface stepWaitUntilTimeWindowLogicActions {}[]delay_duration?: string | undefined}+ | {+ filters: {+ properties?: any[] | undefined+ }+ type: 'github-event'+ }| {filters: {properties?: any[] | undefineddiff --git a/products/workflows/frontend/Workflows/hogflows/steps/types.ts b/products/workflows/frontend/Workflows/hogflows/steps/types.tsindex d4f8cf2271dd..f1f135d2744d 100644--- a/products/workflows/frontend/Workflows/hogflows/steps/types.ts+++ b/products/workflows/frontend/Workflows/hogflows/steps/types.ts@@ -205,6 +205,13 @@ export const HogFlowTriggerSchema = z.discriminatedUnion('type', [}),key_property: z.string().optional(),}),+ z.object({+ type: z.literal('github-event'),+ filters: z.object({+ // Delivery properties only, repository and event type included — see the registry entry+ properties: z.array(z.any()).optional(),+ }),+ }),])/** Trigger types that use HogFlowSchedule for recurring execution */diff --git a/products/workflows/frontend/Workflows/workflowLogic.ts b/products/workflows/frontend/Workflows/workflowLogic.tsindex fb2296dc1c85..fe611cd2f8f9 100644--- a/products/workflows/frontend/Workflows/workflowLogic.ts+++ b/products/workflows/frontend/Workflows/workflowLogic.ts@@ -115,7 +115,12 @@ export const PERSON_DEPENDENT_ACTION_TYPES = new Set(['wait_until_condition', 'r// Trigger types whose runs have no person attached: a synced warehouse row, a materialized view// row, and a Slack poster are all things no PostHog person is attached to. Keep in sync with the// backend's ROW_SCOPED_TRIGGER_TYPES, which is the authoritative check.-export const ROW_SCOPED_TRIGGER_TYPES = new Set(['data-warehouse-table', 'data-warehouse-view', 'slack-message'])+export const ROW_SCOPED_TRIGGER_TYPES = new Set([+ 'data-warehouse-table',+ 'data-warehouse-view',+ 'slack-message',+ 'github-event',+])function getTemplatingError(value: string, templating?: 'liquid' | 'hog'): string | undefined {if (templating === 'liquid' && typeof value === 'string') {@@ -770,6 +775,12 @@ export interface workflowLogicActions {}type: 'event'}+ | {+ filters: {+ properties?: any[] | undefined+ }+ type: 'github-event'+ }| {filters: {properties?: any[] | undefined@@ -1043,6 +1054,12 @@ export interface workflowLogicActions {}type: 'event'}+ | {+ filters: {+ properties?: any[] | undefined+ }+ type: 'github-event'+ }| {filters: {properties?: any[] | undefined@@ -1617,6 +1634,12 @@ export interface workflowLogicActions {}type: 'event'}+ | {+ filters: {+ properties?: any[] | undefined+ }+ type: 'github-event'+ }| {filters: {properties?: any[] | undefined@@ -1890,6 +1913,12 @@ export interface workflowLogicActions {}type: 'event'}+ | {+ filters: {+ properties?: any[] | undefined+ }+ type: 'github-event'+ }| {filters: {properties?: any[] | undefined@@ -2071,6 +2100,12 @@ export interface workflowLogicActions {}type: 'event'}+ | {+ filters: {+ properties?: any[] | undefined+ }+ type: 'github-event'+ }| {filters: {properties?: any[] | undefined@@ -2446,6 +2481,12 @@ export interface workflowLogicActions {}type: 'event'}+ | {+ filters: {+ properties?: any[] | undefined+ }+ type: 'github-event'+ }| {filters: {properties?: any[] | undefined@@ -2837,6 +2878,12 @@ export interface workflowLogicMeta {}type: 'event'}+ | {+ filters: {+ properties?: any[] | undefined+ }+ type: 'github-event'+ }| {filters: {properties?: any[] | undefineddiff --git a/products/workflows/frontend/generated/api.schemas.ts b/products/workflows/frontend/generated/api.schemas.tsindex 03d4870b24bb..ad02a96a1b17 100644--- a/products/workflows/frontend/generated/api.schemas.ts+++ b/products/workflows/frontend/generated/api.schemas.ts@@ -443,7 +443,7 @@ export const HogFlowActionTypeEnumApi = {} as const/**- * Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}.+ * Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. github-event runs once per matching GitHub delivery, and takes only filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility). repository and event_type are required, each with an exact-match filter; without them the trigger runs on every delivery from every connected repository. Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}.*/export type HogFlowActionApiConfig =| { [key: string]: unknown }@@ -504,7 +504,7 @@ export interface HogFlowActionApi {* * `random_cohort_branch` - random_cohort_branch* * `exit` - exit */type: HogFlowActionTypeEnumApi- /** Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}. */+ /** Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. github-event runs once per matching GitHub delivery, and takes only filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility). repository and event_type are required, each with an exact-match filter; without them the trigger runs on every delivery from every connected repository. Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}. */config: HogFlowActionApiConfig/** Output variable for downstream actions: {key, result_path?, spread?, label?} or a list of those. */output_variable?: unknowndiff --git a/products/workflows/frontend/generated/api.zod.ts b/products/workflows/frontend/generated/api.zod.tsindex 1faec0fc67ba..d2c9c6b1eb20 100644--- a/products/workflows/frontend/generated/api.zod.ts+++ b/products/workflows/frontend/generated/api.zod.ts@@ -743,7 +743,7 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod),]).describe(- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. github-event runs once per matching GitHub delivery, and takes only filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility). repository and event_type are required, each with an exact-match filter; without them the trigger runs on every delivery from every connected repository. Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."),output_variable: zod.unknown()@@ -1121,7 +1121,7 @@ export const HogFlowsUpdateBody = /* @__PURE__ */ zod),]).describe(- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. github-event runs once per matching GitHub delivery, and takes only filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility). repository and event_type are required, each with an exact-match filter; without them the trigger runs on every delivery from every connected repository. Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."),output_variable: zod.unknown()@@ -1504,7 +1504,7 @@ export const HogFlowsPartialUpdateBody = /* @__PURE__ */ zod),]).describe(- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. github-event runs once per matching GitHub delivery, and takes only filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility). repository and event_type are required, each with an exact-match filter; without them the trigger runs on every delivery from every connected repository. Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."),output_variable: zod.unknown()@@ -2143,7 +2143,7 @@ export const HogFlowsInvocationsCreateBody = /* @__PURE__ */ zod.object({),]).describe(- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. github-event runs once per matching GitHub delivery, and takes only filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility). repository and event_type are required, each with an exact-match filter; without them the trigger runs on every delivery from every connected repository. Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."),output_variable: zod.unknown()@@ -2793,7 +2793,7 @@ export const HogFlowsBulkDeleteCreateBody = /* @__PURE__ */ zod),]).describe(- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. github-event runs once per matching GitHub delivery, and takes only filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility). repository and event_type are required, each with an exact-match filter; without them the trigger runs on every delivery from every connected repository. Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."),output_variable: zod.unknown()diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 104c6029c6e8..89fd61203160 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -41732,7 +41732,7 @@ export namespace Schemas {} as const;/**- * Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}.+ * Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. github-event runs once per matching GitHub delivery, and takes only filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility). repository and event_type are required, each with an exact-match filter; without them the trigger runs on every delivery from every connected repository. Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}.*/export type HogFlowActionConfig = { [key: string]: unknown } | {/** Property-based wait condition; continues when the person matches. A condition with no property filters is ignored — the wait then relies on 'events' and the max_wait_duration timeout. */@@ -41791,7 +41791,7 @@ export namespace Schemas {* * `random_cohort_branch` - random_cohort_branch* * `exit` - exit */type: HogFlowActionTypeEnum;- /** Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}. */+ /** Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. github-event runs once per matching GitHub delivery, and takes only filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility). repository and event_type are required, each with an exact-match filter; without them the trigger runs on every delivery from every connected repository. Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}. */config: HogFlowActionConfig;/** Output variable for downstream actions: {key, result_path?, spread?, label?} or a list of those. */output_variable?: unknown;diff --git a/services/mcp/src/generated/workflows/api.ts b/services/mcp/src/generated/workflows/api.tsindex 28d03b00cd4e..12aa93dbb93a 100644--- a/services/mcp/src/generated/workflows/api.ts+++ b/services/mcp/src/generated/workflows/api.ts@@ -406,7 +406,7 @@ export const HogFlowsCreateBody = /* @__PURE__ */ zod),]).describe(- "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."+ "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. github-event runs once per matching GitHub delivery, and takes only filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility). repository and event_type are required, each with an exact-match filter; without them the trigger runs on every delivery from every connected repository. Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function\*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open\/click tracking, so opens and clicks are not recorded for that step (delivery\/bounce\/unsubscribe still are). Dictionary input values are template strings too — write booleans\/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person\/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."),output_variable: zod.unknown()diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.jsonindex 9e71351bbc46..67425141516f 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/workflows-create.json@@ -195,7 +195,7 @@"type": "object"}],- "description": "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."+ "description": "Type-specific config keyed by action type. trigger: {type: event|webhook|manual|batch|schedule|tracking_pixel|slack-message|github-event, filters?}. slack-message runs once per message posted in a connected Slack channel, and takes only filters: {properties: [<cond>]} over the message properties (channel, user, bot_id, text, subtype, is_thread_reply). Runs are person-less, so person-dependent steps are rejected. github-event runs once per matching GitHub delivery, and takes only filters: {properties: [<cond>]} over the delivery properties (repository, event_type, action, sender, bot_sender, own_app, author_association, actor_access, title, body, review_state, branch, repository_visibility). repository and event_type are required, each with an exact-match filter; without them the trigger runs on every delivery from every connected repository. Runs are person-less, so person-dependent steps are rejected. webhook and manual triggers also require template_id: 'template-source-webhook', and tracking_pixel requires template_id: 'template-source-webhook-pixel'. filters shape: {events: [{id, name, type:'events', properties:[<cond>]}], properties:[<cond>], actions:[...], filter_test_accounts:<bool>}. <cond>: {key, value, operator, type: event|person|group}, or {key: 'id', type: 'cohort', value: <cohort_id>, operator: 'in'} to reference a cohort. batch triggers may set filters.audience_type: 'persons' (default) or 'accounts'. An accounts audience fans out one run per customer analytics account and takes account filters instead: properties entries of type 'account_custom_property' (key = definition id), plus tag_names: [<str>], assigned_to_user_ids: [<int>], all_roles_unassigned: <bool>. function*: {template_id, inputs: {<key>: {value: <str>}}}. Wrap values in {value:...} to enable hog templating ({person.x}, {event.x}); flat strings won't interpolate. function_email also accepts tracking_enabled?: <bool> (default true) - when false, no open pixel is injected, links are not rewritten, and the send skips ESP-level open/click tracking, so opens and clicks are not recorded for that step (delivery/bounce/unsubscribe still are). Dictionary input values are template strings too — write booleans/numbers as single-expression templates ('{true}', '{42}'), which evaluate to the typed value. delay: waits a fixed span or until a per-person/-event date — set EXACTLY ONE of delay_duration or delay_until. {delay_duration: '<number><unit>'} where unit is s|m|h|d. Fractions OK ('1.5d'=36h). Per-unit max s<=60, m<=60, h<=24, d<=30; values above are SILENTLY CLAMPED. Max 30d. delay_until: {expression: '<SQL>', offset?: '<±number><unit>'} waits until the date expression evaluates to (an ISO string, unix seconds, or a date value all resolve to the same instant); offset is a signed duration shifting it ('-1d' a day before, '2h' two hours after). expression is compiled server-side, so any bytecode sent with it is discarded. A person property is person.properties.<key>; an event property is properties.<key>, as the 'event.' prefix resolves to nothing and aborts the run. Optional timezone (IANA name), use_person_timezone (read $geoip_time_zone) and fallback_timezone decide which zone a date with no offset of its own is read in; a date that states an offset, and unix seconds, ignore them. Default UTC. Optional sibling max_delay_duration (default 30d, same '<number><unit>' format) caps how far past the step's start the wait may run. conditional_branch: {conditions: [{filters}, ...]}. Index N matches the 'branch' edge with index:N. random_cohort_branch: {cohorts: [{percentage: <number>, name?}, ...]}. Index N matches the 'branch' edge with index:N; percentages are relative weights, so they should sum to 100 but a total above or below that still splits traffic in the given proportions. wait_until_condition: {condition: {filters}, events?: [{filters: {events: [{id, name, type: 'events'}], actions?: [...]}, name?}], max_wait_duration: <duration>} (same rules as delay). Continues when condition.filters match OR any events entry fires; each events entry must target at least one event or action. On resolution (a condition match or any events entry firing) it advances via the 'branch' edge with index:0; the max_wait_duration timeout falls through the 'continue' edge. exit: {reason}."},"created_at": {"description": "Created at (epoch ms). Frontend-managed.",