GitHub event
Pull request opened
Inspect the diff and create a demo only when it changes the frontend. Backend-only changes skip video; frontend demos are uploaded to S3 and linked from the GitHub pull request.
type Repository = { name: text, url: text }
type PullRequest = { number: int, url: text }
type ChangeKind = choice {
frontend { paths: [text] }
backend_only { paths: [text] }
}
type Demo = { summary: text, video_url: text }
type Upload = { video_url: text }
trigger pull_request:
kind: github
config: {
path: "/api/github/webhook"
target: { one: { repo: "acme/app" } }
actions: ["opened", "synchronize"]
}
out:
pr: PullRequest
commit: text
repository: Repository
base_ref: text
runner agent:
kind: opencode
in: open
out: open
step inspect_changes:
runner: agent
in:
prompt: "Inspect changed paths and classify as frontend or backend_only."
repo: { url: pull_request.repository.url, ref: pull_request.commit }
base: pull_request.base_ref
out: { change: ChangeKind }
step create_demo:
runner: agent
when: inspect_changes.change is frontend
in:
prompt: "Create a short demo video of the frontend changes."
repo: { url: pull_request.repository.url, ref: pull_request.commit }
paths: inspect_changes.change.frontend.paths
out: { demo: Demo }
step upload_video:
kind: s3
when: inspect_changes.change is frontend
in: { video: create_demo.demo.video_url }
out: { upload: Upload }
step link_video:
runner: agent
when: inspect_changes.change is frontend
in:
prompt: "Comment on the pull request with the uploaded demo link."
pr: pull_request.pr
video_url: upload_video.upload.video_url
out: { comment_url: text }
step skipped:
kind: file
when: inspect_changes.change is backend_only
config: { path: "out/video-skipped.json" }
in: { reason: "No frontend changes; video generation skipped." }