Skip to content

🙌 OpenHands: AI-Driven Development

feat: expose event trigger details in automation UI (#1007)

Jathin Sreenivasd128a3ef0e8c
diff --git a/__tests__/api/automation-handlers.test.ts b/__tests__/api/automation-handlers.test.ts
index 6990ede195..e16c6cd77d 100644
--- a/__tests__/api/automation-handlers.test.ts
+++ b/__tests__/api/automation-handlers.test.ts
@@ -23,8 +23,10 @@ describe("Automation MSW Handlers", () => {
const data = await res.json();
expect(res.status).toBe(200);
- expect(data.automations).toHaveLength(5);
- expect(data.total).toBe(5);
+ expect(data.automations).toHaveLength(
+ MOCK_AUTOMATIONS_RESPONSE.automations.length,
+ );
+ expect(data.total).toBe(MOCK_AUTOMATIONS_RESPONSE.total);
});
it("respects pagination parameters", async () => {
diff --git a/__tests__/components/automations/detail/configuration-section.test.tsx b/__tests__/components/automations/detail/configuration-section.test.tsx
new file mode 100644
index 0000000000..92ebe12896
--- /dev/null
+++ b/__tests__/components/automations/detail/configuration-section.test.tsx
@@ -0,0 +1,117 @@
+import { describe, it, expect } from "vitest";
+import { render, screen } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { ConfigurationSection } from "#/components/features/automations/detail/configuration-section";
+import type { Automation } from "#/types/automation";
+
+const cronAutomation: Automation = {
+ id: "auto-1",
+ name: "Daily digest",
+ prompt: "Summarize PRs",
+ trigger: {
+ type: "cron",
+ schedule: "0 9 * * *",
+ schedule_human: "Daily at 09:00",
+ },
+ enabled: true,
+ created_at: "2026-01-01T00:00:00Z",
+ updated_at: "2026-01-01T00:00:00Z",
+ model: "fast-model",
+ repository: "acme/app",
+ branch: "main",
+ timezone: "UTC",
+};
+
+const eventAutomation: Automation = {
+ id: "auto-2",
+ name: "PR Review Bot",
+ prompt: "Review PRs",
+ trigger: {
+ type: "event",
+ source: "github",
+ on: "pull_request.opened",
+ filter: "repository.full_name == 'acme/frontend-app'",
+ },
+ enabled: true,
+ created_at: "2026-01-01T00:00:00Z",
+ updated_at: "2026-01-01T00:00:00Z",
+ model: "review-model",
+ repository: "acme/frontend-app",
+ branch: "main",
+};
+
+const eventMultiPatternAutomation: Automation = {
+ ...eventAutomation,
+ id: "auto-3",
+ trigger: {
+ type: "event",
+ source: "github",
+ on: ["push", "release.published"],
+ filter: "glob(release.tag_name, 'v*')",
+ },
+};
+
+describe("ConfigurationSection", () => {
+ it("renders cron trigger with schedule", () => {
+ render(<ConfigurationSection automation={cronAutomation} />);
+
+ // t() returns the key in tests
+ expect(
+ screen.getByText("AUTOMATIONS$DETAIL$TRIGGER_SCHEDULE"),
+ ).toBeInTheDocument();
+ expect(screen.getByText("Daily at 09:00 (UTC)")).toBeInTheDocument();
+ expect(screen.getByText("fast-model")).toBeInTheDocument();
+ expect(screen.getByText("acme/app")).toBeInTheDocument();
+ });
+
+ it("renders event trigger with source, event type, and filter", () => {
+ render(<ConfigurationSection automation={eventAutomation} />);
+
+ expect(
+ screen.getByText("AUTOMATIONS$DETAIL$TRIGGER_EVENT"),
+ ).toBeInTheDocument();
+ expect(screen.getByText("github")).toBeInTheDocument();
+ expect(screen.getByText("pull_request.opened")).toBeInTheDocument();
+ expect(
+ screen.getByText("repository.full_name == 'acme/frontend-app'"),
+ ).toBeInTheDocument();
+ });
+
+ it("does not show schedule field for event triggers", () => {
+ render(<ConfigurationSection automation={eventAutomation} />);
+
+ expect(
+ screen.queryByText("AUTOMATIONS$DETAIL$SCHEDULE"),
+ ).not.toBeInTheDocument();
+ });
+
+ it("renders multiple event patterns joined by comma", () => {
+ render(<ConfigurationSection automation={eventMultiPatternAutomation} />);
+
+ expect(screen.getByText("push, release.published")).toBeInTheDocument();
+ });
+
+ it("shows expand/collapse for long filter expressions", async () => {
+ const longFilter =
+ "repository.full_name == 'acme/frontend-app' && contains(pull_request.labels[].name, 'needs-review') && sender.login != 'bot'";
+ const automation: Automation = {
+ ...eventAutomation,
+ trigger: {
+ type: "event",
+ source: "github",
+ on: "pull_request.opened",
+ filter: longFilter,
+ },
+ };
+
+ const user = userEvent.setup();
+ render(<ConfigurationSection automation={automation} />);
+
+ expect(screen.getByText("SETTINGS$SKILLS_SHOW_MORE")).toBeInTheDocument();
+ expect(screen.queryByText(longFilter)).not.toBeInTheDocument();
+
+ await user.click(screen.getByText("SETTINGS$SKILLS_SHOW_MORE"));
+ expect(screen.getByText(longFilter)).toBeInTheDocument();
+ expect(screen.getByText("SETTINGS$SKILLS_SHOW_LESS")).toBeInTheDocument();
+ });
+});
diff --git a/src/components/features/automations/automation-card.tsx b/src/components/features/automations/automation-card.tsx
index ba58e24e89..bbaf8ee354 100644
--- a/src/components/features/automations/automation-card.tsx
+++ b/src/components/features/automations/automation-card.tsx
@@ -6,6 +6,8 @@ import { KebabMenu } from "./kebab-menu";
import { useHasPermission } from "#/hooks/use-has-permission";
import { useNavigation } from "#/context/navigation-context";
import PlayIcon from "#/icons/play.svg?react";
+import ClockIcon from "#/icons/clock.svg?react";
+import GlobeIcon from "#/icons/globe.svg?react";
import { SkillCardPillRow } from "#/components/features/skills/skill-card-pill-row";
import { cn } from "#/utils/utils";
import {
@@ -81,8 +83,13 @@ export function AutomationCard({
>
<header className="flex items-start justify-between gap-3">
<div className="flex min-w-0 flex-1 flex-col gap-1.5">
- <h3 className="truncate text-sm font-semibold text-white">
- {automation.name}
+ <h3 className="flex items-center gap-2 truncate text-sm font-semibold text-white">
+ {automation.trigger.type === "event" ? (
+ <GlobeIcon className="size-4 shrink-0 text-muted" />
+ ) : (
+ <ClockIcon className="size-4 shrink-0 text-muted" />
+ )}
+ <span className="truncate">{automation.name}</span>
</h3>
{automation.prompt ? (
<p className="line-clamp-2 text-xs leading-relaxed text-tertiary-light">
diff --git a/src/components/features/automations/automation-list-row.tsx b/src/components/features/automations/automation-list-row.tsx
index 352027a6c3..df43e31445 100644
--- a/src/components/features/automations/automation-list-row.tsx
+++ b/src/components/features/automations/automation-list-row.tsx
@@ -6,6 +6,8 @@ import { KebabMenu } from "./kebab-menu";
import { useHasPermission } from "#/hooks/use-has-permission";
import { useNavigation } from "#/context/navigation-context";
import PlayIcon from "#/icons/play.svg?react";
+import ClockIcon from "#/icons/clock.svg?react";
+import GlobeIcon from "#/icons/globe.svg?react";
import { StyledTooltip } from "#/components/shared/buttons/styled-tooltip";
import { SkillCardPillRow } from "#/components/features/skills/skill-card-pill-row";
import { cn } from "#/utils/utils";
@@ -79,6 +81,11 @@ export function AutomationListRow({
>
<td className={automationListCellClassName}>
<div className="flex min-w-0 items-center gap-1.5">
+ {automation.trigger.type === "event" ? (
+ <GlobeIcon className="size-4 shrink-0 text-muted" />
+ ) : (
+ <ClockIcon className="size-4 shrink-0 text-muted" />
+ )}
<span
className="max-w-[40%] shrink-0 truncate text-sm font-medium text-white"
title={automation.name}
diff --git a/src/components/features/automations/build-automation-pills.tsx b/src/components/features/automations/build-automation-pills.tsx
index b0c7bf1d41..246bb04ab5 100644
--- a/src/components/features/automations/build-automation-pills.tsx
+++ b/src/components/features/automations/build-automation-pills.tsx
@@ -1,10 +1,12 @@
import FolderIcon from "#/icons/folder.svg?react";
import ClockIcon from "#/icons/clock.svg?react";
import SparkleIcon from "#/icons/sparkle.svg?react";
+import GlobeIcon from "#/icons/globe.svg?react";
import type { SkillCardPill } from "#/components/features/skills/skill-card-pill-row";
import type { Automation } from "#/types/automation";
import { cn } from "#/utils/utils";
import { extensionModuleCardPillClassName } from "#/utils/extension-module-card-classes";
+import { formatEventOn } from "#/utils/automation-schedule";
export function buildAutomationMetadataPills(
automation: Automation,
@@ -24,15 +26,34 @@ export function buildAutomationMetadataPills(
});
}
- pills.push({
- id: "schedule",
- node: (
- <span className={cn(extensionModuleCardPillClassName, "gap-1")}>
- <ClockIcon className="size-3 shrink-0" />
- {scheduleLabel}
- </span>
- ),
- });
+ if (automation.trigger.type === "event") {
+ const eventLabel = [
+ automation.trigger.on ? formatEventOn(automation.trigger.on) : "",
+ automation.trigger.source ? `(${automation.trigger.source})` : "",
+ ]
+ .filter(Boolean)
+ .join(" ");
+
+ pills.push({
+ id: "event-trigger",
+ node: (
+ <span className={cn(extensionModuleCardPillClassName, "gap-1")}>
+ <GlobeIcon className="size-3 shrink-0" />
+ {eventLabel}
+ </span>
+ ),
+ });
+ } else {
+ pills.push({
+ id: "schedule",
+ node: (
+ <span className={cn(extensionModuleCardPillClassName, "gap-1")}>
+ <ClockIcon className="size-3 shrink-0" />
+ {scheduleLabel}
+ </span>
+ ),
+ });
+ }
if (automation.model) {
pills.push({
diff --git a/src/components/features/automations/detail/configuration-section.tsx b/src/components/features/automations/detail/configuration-section.tsx
index dba5eee3f5..e526e6f392 100644
--- a/src/components/features/automations/detail/configuration-section.tsx
+++ b/src/components/features/automations/detail/configuration-section.tsx
@@ -1,3 +1,4 @@
+import { useState } from "react";
import { useTranslation } from "react-i18next";
import { I18nKey } from "#/i18n/declaration";
import type { Automation } from "#/types/automation";
@@ -7,6 +8,10 @@ import CheckCircleIcon from "#/icons/check-circle.svg?react";
import CalendarIcon from "#/icons/calendar.svg?react";
import SparkleIcon from "#/icons/sparkle.svg?react";
import BellIcon from "#/icons/bell.svg?react";
+import GlobeIcon from "#/icons/globe.svg?react";
+import CodeTagIcon from "#/icons/code-tag.svg?react";
+import LinkExternalIcon from "#/icons/link-external.svg?react";
+import { formatEventOn } from "#/utils/automation-schedule";
import { SectionCard } from "./section-card";
import { ConfigField } from "./config-field";
import { BranchBadge } from "./branch-badge";
@@ -15,10 +20,41 @@ interface ConfigurationSectionProps {
automation: Automation;
}
+const FILTER_TRUNCATE_LENGTH = 60;
+
+function FilterExpression({ filter }: { filter: string }) {
+ const { t } = useTranslation("openhands");
+ const [expanded, setExpanded] = useState(false);
+ const isLong = filter.length > FILTER_TRUNCATE_LENGTH;
+
+ return (
+ <div className="flex flex-col gap-1">
+ <span className="break-all">
+ {isLong && !expanded
+ ? `${filter.slice(0, FILTER_TRUNCATE_LENGTH)}…`
+ : filter}
+ </span>
+ {isLong && (
+ <button
+ type="button"
+ onClick={() => setExpanded(!expanded)}
+ aria-expanded={expanded}
+ className="text-xs text-muted hover:text-content self-start"
+ >
+ {expanded
+ ? t(I18nKey.SETTINGS$SKILLS_SHOW_LESS)
+ : t(I18nKey.SETTINGS$SKILLS_SHOW_MORE)}
+ </button>
+ )}
+ </div>
+ );
+}
+
export function ConfigurationSection({
automation,
}: ConfigurationSectionProps) {
const { t } = useTranslation("openhands");
+ const isEvent = automation.trigger.type === "event";
let scheduleDisplay = automation.trigger.schedule ?? "";
if (automation.trigger.schedule_human) {
@@ -27,8 +63,9 @@ export function ConfigurationSection({
: automation.trigger.schedule_human;
}
- const triggerDisplay =
- automation.trigger.type === "cron" ? "Schedule" : automation.trigger.type;
+ const triggerDisplay = isEvent
+ ? t(I18nKey.AUTOMATIONS$DETAIL$TRIGGER_EVENT)
+ : t(I18nKey.AUTOMATIONS$DETAIL$TRIGGER_SCHEDULE);
return (
<SectionCard
@@ -55,12 +92,41 @@ export function ConfigurationSection({
{triggerDisplay}
</ConfigField>
- <ConfigField
- icon={<CalendarIcon className="size-3.5" />}
- label={t(I18nKey.AUTOMATIONS$DETAIL$SCHEDULE)}
- >
- {scheduleDisplay}
- </ConfigField>
+ {!isEvent && (
+ <ConfigField
+ icon={<CalendarIcon className="size-3.5" />}
+ label={t(I18nKey.AUTOMATIONS$DETAIL$SCHEDULE)}
+ >
+ {scheduleDisplay}
+ </ConfigField>
+ )}
+
+ {isEvent && automation.trigger.source && (
+ <ConfigField
+ icon={<GlobeIcon className="size-3.5" />}
+ label={t(I18nKey.AUTOMATIONS$DETAIL$EVENT_SOURCE)}
+ >
+ {automation.trigger.source}
+ </ConfigField>
+ )}
+
+ {isEvent && automation.trigger.on && (
+ <ConfigField
+ icon={<LinkExternalIcon className="size-3.5" />}
+ label={t(I18nKey.AUTOMATIONS$DETAIL$EVENT_TYPE)}
+ >
+ {formatEventOn(automation.trigger.on)}
+ </ConfigField>
+ )}
+
+ {isEvent && automation.trigger.filter && (
+ <ConfigField
+ icon={<CodeTagIcon className="size-3.5" />}
+ label={t(I18nKey.AUTOMATIONS$DETAIL$EVENT_FILTER)}
+ >
+ <FilterExpression filter={automation.trigger.filter} />
+ </ConfigField>
+ )}
<ConfigField
icon={<SparkleIcon className="size-3.5" />}
diff --git a/src/components/features/automations/detail/edit-automation-modal.tsx b/src/components/features/automations/detail/edit-automation-modal.tsx
index a8b4995a8a..28c1be83ac 100644
--- a/src/components/features/automations/detail/edit-automation-modal.tsx
+++ b/src/components/features/automations/detail/edit-automation-modal.tsx
@@ -17,6 +17,7 @@ import {
buildCronSchedule,
formatTimeOfDay,
parseTimeOfDay,
+ formatEventOn,
type SchedulePresetKind,
} from "#/utils/automation-schedule";
import { cn } from "#/utils/utils";
@@ -55,6 +56,17 @@ interface FormState {
}
function buildInitialState(automation: Automation): FormState {
+ if (automation.trigger.type === "event") {
+ return {
+ name: automation.name,
+ prompt: automation.prompt ?? "",
+ frequency: "custom",
+ weekday: 1,
+ timeOfDay: "",
+ isCustomSchedule: true,
+ rawSchedule: "",
+ };
+ }
const parsed = parseCronSchedule(automation.trigger.schedule);
if (parsed.kind === "custom") {
return {
@@ -260,73 +272,118 @@ export function EditAutomationModal({
</span>
</label>
- <SettingsDropdownInput
- testId="edit-automation-frequency"
- name="frequency"
- label={t(I18nKey.AUTOMATIONS$FREQUENCY)}
- items={frequencyItems}
- selectedKey={form.frequency}
- isDisabled={form.isCustomSchedule}
- onSelectionChange={(key) => {
- if (!key || form.isCustomSchedule) return;
- setForm((f) => ({ ...f, frequency: key as FrequencyKey }));
- }}
- />
-
- {form.frequency === "weekly" && !form.isCustomSchedule && (
- <SettingsDropdownInput
- testId="edit-automation-weekday"
- name="weekday"
- label={t(I18nKey.AUTOMATIONS$WEEKDAY)}
- items={weekdayItems}
- selectedKey={String(form.weekday)}
- onSelectionChange={(key) => {
- if (key === null) return;
- setForm((f) => ({ ...f, weekday: Number(key) }));
- }}
- />
- )}
+ {automation.trigger.type === "event" ? (
+ <div className="flex flex-col gap-3 rounded-lg bg-[var(--oh-surface-raised)] p-3">
+ <div className="flex items-center gap-2">
+ <span className="text-xs font-medium text-muted">
+ {t(I18nKey.AUTOMATIONS$DETAIL$TRIGGER)}
+ </span>
+ <span className="text-sm text-content">
+ {t(I18nKey.AUTOMATIONS$DETAIL$TRIGGER_EVENT)}
+ </span>
+ </div>
+ {automation.trigger.source && (
+ <div className="flex items-center gap-2">
+ <span className="text-xs font-medium text-muted">
+ {t(I18nKey.AUTOMATIONS$DETAIL$EVENT_SOURCE)}
+ </span>
+ <span className="text-sm text-content">
+ {automation.trigger.source}
+ </span>
+ </div>
+ )}
+ {automation.trigger.on && (
+ <div className="flex items-center gap-2">
+ <span className="text-xs font-medium text-muted">
+ {t(I18nKey.AUTOMATIONS$DETAIL$EVENT_TYPE)}
+ </span>
+ <code className="text-xs font-mono text-content">
+ {formatEventOn(automation.trigger.on)}
+ </code>
+ </div>
+ )}
+ {automation.trigger.filter && (
+ <div className="flex flex-col gap-1">
+ <span className="text-xs font-medium text-muted">
+ {t(I18nKey.AUTOMATIONS$DETAIL$EVENT_FILTER)}
+ </span>
+ <code className="text-xs font-mono text-content break-all">
+ {automation.trigger.filter}
+ </code>
+ </div>
+ )}
+ </div>
+ ) : (
+ <>
+ <SettingsDropdownInput
+ testId="edit-automation-frequency"
+ name="frequency"
+ label={t(I18nKey.AUTOMATIONS$FREQUENCY)}
+ items={frequencyItems}
+ selectedKey={form.frequency}
+ isDisabled={form.isCustomSchedule}
+ onSelectionChange={(key) => {
+ if (!key || form.isCustomSchedule) return;
+ setForm((f) => ({ ...f, frequency: key as FrequencyKey }));
+ }}
+ />
- <label className="flex flex-col gap-2.5 w-full min-w-0">
- <span className="text-sm">
- {t(I18nKey.AUTOMATIONS$TIME_OF_DAY)}
- </span>
- <input
- data-testid="edit-automation-time"
- name="timeOfDay"
- type="time"
- value={form.timeOfDay}
- onChange={(e) =>
- setForm((f) => ({ ...f, timeOfDay: e.target.value }))
- }
- disabled={form.isCustomSchedule && !isTimeEditable}
- className={cn(
- formControlSettingsFieldClassName,
- "disabled:bg-[var(--oh-surface-raised)]",
+ {form.frequency === "weekly" && !form.isCustomSchedule && (
+ <SettingsDropdownInput
+ testId="edit-automation-weekday"
+ name="weekday"
+ label={t(I18nKey.AUTOMATIONS$WEEKDAY)}
+ items={weekdayItems}
+ selectedKey={String(form.weekday)}
+ onSelectionChange={(key) => {
+ if (key === null) return;
+ setForm((f) => ({ ...f, weekday: Number(key) }));
+ }}
+ />
)}
- />
- {automation.timezone && (
- <span className="text-xs text-muted">
- {t(I18nKey.AUTOMATIONS$TIMEZONE)}: {automation.timezone}
- </span>
- )}
- </label>
- {form.isCustomSchedule && (
- <p
- className="text-xs text-muted"
- data-testid="custom-schedule-hint"
- >
- {t(I18nKey.AUTOMATIONS$CUSTOM_SCHEDULE_HINT)}
- {form.rawSchedule && (
- <>
- {" "}
- <code className="text-xs text-content">
- {form.rawSchedule}
- </code>
- </>
+ <label className="flex flex-col gap-2.5 w-full min-w-0">
+ <span className="text-sm">
+ {t(I18nKey.AUTOMATIONS$TIME_OF_DAY)}
+ </span>
+ <input
+ data-testid="edit-automation-time"
+ name="timeOfDay"
+ type="time"
+ value={form.timeOfDay}
+ onChange={(e) =>
+ setForm((f) => ({ ...f, timeOfDay: e.target.value }))
+ }
+ disabled={form.isCustomSchedule && !isTimeEditable}
+ className={cn(
+ formControlSettingsFieldClassName,
+ "disabled:bg-[var(--oh-surface-raised)]",
+ )}
+ />
+ {automation.timezone && (
+ <span className="text-xs text-muted">
+ {t(I18nKey.AUTOMATIONS$TIMEZONE)}: {automation.timezone}
+ </span>
+ )}
+ </label>
+
+ {form.isCustomSchedule && (
+ <p
+ className="text-xs text-muted"
+ data-testid="custom-schedule-hint"
+ >
+ {t(I18nKey.AUTOMATIONS$CUSTOM_SCHEDULE_HINT)}
+ {form.rawSchedule && (
+ <>
+ {" "}
+ <code className="text-xs text-content">
+ {form.rawSchedule}
+ </code>
+ </>
+ )}
+ </p>
)}
- </p>
+ </>
)}
<div className="mt-2 flex justify-end gap-3">
diff --git a/src/i18n/translation.json b/src/i18n/translation.json
index 9382f1fbfa..44ef0baf8c 100644
--- a/src/i18n/translation.json
+++ b/src/i18n/translation.json
@@ -13463,6 +13463,91 @@
"uk": "Тригер",
"ca": "Activador"
},
+ "AUTOMATIONS$DETAIL$TRIGGER_SCHEDULE": {
+ "en": "Schedule",
+ "ja": "スケジュール",
+ "zh-CN": "定时",
+ "zh-TW": "排程",
+ "ko-KR": "예약",
+ "no": "Tidsplan",
+ "it": "Pianificato",
+ "pt": "Agendado",
+ "es": "Programado",
+ "ar": "مجدول",
+ "fr": "Planifié",
+ "tr": "Zamanlanmış",
+ "de": "Geplant",
+ "uk": "За розкладом",
+ "ca": "Planificat"
+ },
+ "AUTOMATIONS$DETAIL$TRIGGER_EVENT": {
+ "en": "Event",
+ "ja": "イベント",
+ "zh-CN": "事件",
+ "zh-TW": "事件",
+ "ko-KR": "이벤트",
+ "no": "Hendelse",
+ "it": "Evento",
+ "pt": "Evento",
+ "es": "Evento",
+ "ar": "حدث",
+ "fr": "Événement",
+ "tr": "Olay",
+ "de": "Ereignis",
+ "uk": "Подія",
+ "ca": "Esdeveniment"
+ },
+ "AUTOMATIONS$DETAIL$EVENT_SOURCE": {
+ "en": "Event Source",
+ "ja": "イベントソース",
+ "zh-CN": "事件来源",
+ "zh-TW": "事件來源",
+ "ko-KR": "이벤트 소스",
+ "no": "Hendelseskilde",
+ "it": "Origine evento",
+ "pt": "Fonte do evento",
+ "es": "Origen del evento",
+ "ar": "مصدر الحدث",
+ "fr": "Source de l'événement",
+ "tr": "Olay kaynağı",
+ "de": "Ereignisquelle",
+ "uk": "Джерело події",
+ "ca": "Font de l'esdeveniment"
+ },
+ "AUTOMATIONS$DETAIL$EVENT_TYPE": {
+ "en": "Event Type",
+ "ja": "イベントタイプ",
+ "zh-CN": "事件类型",
+ "zh-TW": "事件類型",
+ "ko-KR": "이벤트 유형",
+ "no": "Hendelsestype",
+ "it": "Tipo di evento",
+ "pt": "Tipo de evento",
+ "es": "Tipo de evento",
+ "ar": "نوع الحدث",
+ "fr": "Type d'événement",
+ "tr": "Olay türü",
+ "de": "Ereignistyp",
+ "uk": "Тип події",
+ "ca": "Tipus d'esdeveniment"
+ },
+ "AUTOMATIONS$DETAIL$EVENT_FILTER": {
+ "en": "Filter",
+ "ja": "フィルター",
+ "zh-CN": "过滤器",
+ "zh-TW": "篩選器",
+ "ko-KR": "필터",
+ "no": "Filter",
+ "it": "Filtro",
+ "pt": "Filtro",
+ "es": "Filtro",
+ "ar": "مرشح",
+ "fr": "Filtre",
+ "tr": "Filtre",
+ "de": "Filter",
+ "uk": "Фільтр",
+ "ca": "Filtre"
+ },
"AUTOMATIONS$BACKEND_UNAVAILABLE_TITLE": {
"en": "Automations Unavailable",
"ja": "オートメーションが利用できません",
diff --git a/src/mocks/automation-runs.mock.ts b/src/mocks/automation-runs.mock.ts
index 51265a8313..cc5ca72186 100644
--- a/src/mocks/automation-runs.mock.ts
+++ b/src/mocks/automation-runs.mock.ts
@@ -61,4 +61,15 @@ export const MOCK_AUTOMATION_RUNS: Record<string, AutomationRun[]> = {
makeRun("r4-02", AutomationRunStatus.COMPLETED, 21, 11),
],
"a1000000-0000-0000-0000-000000000005": [],
+ "a1000000-0000-0000-0000-000000000006": [
+ makeRun("r6-01", AutomationRunStatus.COMPLETED, 0, 14),
+ makeRun("r6-02", AutomationRunStatus.COMPLETED, 0, 11),
+ makeRun("r6-03", AutomationRunStatus.FAILED, 1, 16),
+ makeRun("r6-04", AutomationRunStatus.COMPLETED, 2, 10),
+ makeRun("r6-05", AutomationRunStatus.COMPLETED, 3, 9),
+ ],
+ "a1000000-0000-0000-0000-000000000007": [
+ makeRun("r7-01", AutomationRunStatus.COMPLETED, 3, 15),
+ makeRun("r7-02", AutomationRunStatus.COMPLETED, 10, 12),
+ ],
};
diff --git a/src/mocks/automations.mock.ts b/src/mocks/automations.mock.ts
index cc70fcd345..6f47fff4d1 100644
--- a/src/mocks/automations.mock.ts
+++ b/src/mocks/automations.mock.ts
@@ -122,6 +122,48 @@ export const MOCK_AUTOMATIONS_RESPONSE: AutomationsResponse = {
timezone: "UTC",
last_triggered_at: null,
},
+ {
+ id: "a1000000-0000-0000-0000-000000000006",
+ name: "PR Review on Open",
+ trigger: {
+ type: "event",
+ source: "github",
+ on: "pull_request.opened",
+ filter: "repository.full_name == 'acme/frontend-app'",
+ },
+ enabled: true,
+ repository: "acme/frontend-app",
+ model: "review-fast",
+ created_at: daysAgo(15),
+ updated_at: now,
+ prompt:
+ "When a new PR is opened, perform a thorough code review focusing on correctness, security, and performance. Post findings as inline comments.",
+ branch: "main",
+ plugins: ["GitHub"],
+ notification: "GitHub PR comment",
+ last_triggered_at: daysAgo(0),
+ },
+ {
+ id: "a1000000-0000-0000-0000-000000000007",
+ name: "Release Notes Generator",
+ trigger: {
+ type: "event",
+ source: "github",
+ on: "release.published",
+ filter: "glob(release.tag_name, 'v*') && !release.prerelease",
+ },
+ enabled: true,
+ repository: "acme/backend-api",
+ model: "docs-fast",
+ created_at: daysAgo(10),
+ updated_at: now,
+ prompt:
+ "Generate comprehensive release notes from the commits since the last release. Include breaking changes, new features, and bug fixes.",
+ branch: "main",
+ plugins: ["GitHub"],
+ notification: "GitHub release body update",
+ last_triggered_at: daysAgo(3),
+ },
],
- total: 5,
+ total: 7,
};
diff --git a/src/types/automation.ts b/src/types/automation.ts
index d889ef4582..908bd1f2a7 100644
--- a/src/types/automation.ts
+++ b/src/types/automation.ts
@@ -1,7 +1,22 @@
export interface AutomationTrigger {
+ /**
+ * Trigger kind. Known values are the schedule aliases "cron" / "schedule"
+ * (time-based) and "event" (webhook/event-driven). Kept as `string` rather
+ * than a closed union on purpose: the backend emits more than one
+ * scheduled-trigger alias and may introduce new kinds, so UI code branches
+ * on `type === "event"` and treats every other value as a schedule.
+ */
type: string;
+ /** Cron expression (schedule triggers only). */
schedule?: string;
+ /** Human-readable schedule description (schedule triggers only). */
schedule_human?: string;
+ /** Event source, e.g. "github" (event triggers only). */
+ source?: string;
+ /** Event key pattern(s) to match, e.g. "pull_request.opened" or ["push", "release.*"]. */
+ on?: string | string[];
+ /** JMESPath filter expression evaluated against the raw webhook payload. */
+ filter?: string;
}
export interface Automation {
diff --git a/src/utils/automation-schedule.ts b/src/utils/automation-schedule.ts
index 8530e5e47b..240d20211a 100644
--- a/src/utils/automation-schedule.ts
+++ b/src/utils/automation-schedule.ts
@@ -105,3 +105,9 @@ export function parseTimeOfDay(
}
return { hour, minute };
}
+
+export function formatEventOn(on: string | string[] | undefined): string {
+ if (!on) return "—";
+ if (Array.isArray(on)) return on.join(", ");
+ return on;
+}