Skip to content

feat(trigger-dev): GitHub AI agent demo (Hookdeck + Trigger.dev)#6

Merged
leggetter merged 20 commits intomainfrom
feat/trigger-dev-github-ai-agent
Mar 30, 2026
Merged

feat(trigger-dev): GitHub AI agent demo (Hookdeck + Trigger.dev)#6
leggetter merged 20 commits intomainfrom
feat/trigger-dev-github-ai-agent

Conversation

@leggetter
Copy link
Copy Markdown
Collaborator

Summary

Polishes the trigger-dev/github-ai-agent demo: interactive setup, Hookdeck + GitHub webhook fixes, Trigger.dev Production deploy + env sync, transformation + task hardening, docs.

Notes

  • Draft PRs still emit pull_request opened / synchronize events — the AI review task runs the same unless we filter pull_request.draft in code.

Test plan

  • npm run setup / npm run deploy from demo folder
  • Issue labeler / PR review / push → Slack as applicable

Made with Cursor

leggetter and others added 17 commits March 19, 2026 18:28
Three AI-powered tasks triggered by GitHub webhooks via Hookdeck:
- handle-pr: fetches PR diff, generates review summary with Claude, posts as PR comment
- handle-issue: classifies issues with Claude, auto-applies labels
- handle-push: summarizes deployments with Claude, posts to Slack

Includes two integration patterns:
- Pattern A: single Hookdeck connection, fan-out router task
- Pattern B: per-event Hookdeck connections with header-based filter rules

Shared utilities: Hookdeck event verification, GitHub API helpers,
Anthropic SDK wrapper, Slack incoming webhook helper.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- setup-hookdeck.sh: idempotent creation of all Hookdeck resources
  (source, destinations, connections, filters, transformation) for
  both Pattern A and Pattern B using hookdeck CLI upsert
- setup-github-webhook.sh: registers GitHub webhook pointing to
  Hookdeck source URL, checks for existing webhook to avoid duplicates

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- setup.sh walks through all credentials interactively
- Auto-generates GITHUB_WEBHOOK_SECRET (random hex)
- Auto-detects GITHUB_TOKEN from gh CLI
- Auto-detects GITHUB_REPO from current repo
- Prompts with help text for manual credentials
- Slack webhook URL is optional (task logs to console if skipped)
- Supports --check mode to verify .env
- Orchestrates deploy + hookdeck setup + github webhook in sequence

Also: slack.ts gracefully handles missing SLACK_WEBHOOK_URL.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Setup: interactive setup.sh, quoted .env, GITHUB_LABELS from repo, prod-only Trigger keys
- Hookdeck: capture source URL from connection output; GitHub webhook -F active (boolean)
- trigger-wrapper: verified flag from context when headers absent
- Trigger: syncEnvVars + --env-file .env, GITHUB_ACCESS_TOKEN
- Tasks: Hookdeck payload types, Anthropic/GitHub env handling
- Docs + collaboration build plan

Made-with: Cursor
- Summarize any branch by default; GITHUB_PUSH_SUMMARY_DEFAULT_BRANCH_ONLY=true for main-only
- Slack message shows branch; README + .env.example document optional env

Made-with: Cursor
…okdeck fan-out

- Add Mermaid diagrams (vertical), component captions, setup caveat
- Frame Pattern A as Trigger fan-out (router) vs Pattern B as Hookdeck fan-out
- Update collaboration build plan as needed

Made-with: Cursor
…igger.dev co-promotion

- Add GUIDE.md: long-form tutorial covering GitHub webhook automation with
  Hookdeck as the webhook edge and Trigger.dev as the task runtime, with
  Claude powering PR review, issue labeling, and Slack push summaries
- Add images/: annotated screenshots for Hookdeck events, connections,
  source verification, and Trigger.dev run detail views
- Simplify trigger-wrapper.js: remove in-transform HMAC verification;
  source-level verification (GitHub HMAC) is handled by Hookdeck at the
  source, making the payload-level check redundant
- Remove verifyHookdeckEvent from all tasks and lib/verify-hookdeck.ts;
  the _hookdeck.verified flag is no longer set by the transform
- Update setup-hookdeck.sh to reflect current connection names

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Correct JSON formatting in examples for pull request payloads
- Update Hookdeck connections view image to reflect current state
- Add new image for Hookdeck connections overview
- Remove redundant line in the task routing section for clarity
- Remove outdated URL note regarding repository location
- Clarify the behavior of GitHub event delivery when the task router is paused
- Minor formatting adjustments for improved readability
- Add images illustrating AI-generated comments for GitHub PRs and issue labeling
- Include a screenshot of Slack push summary messages generated by the AI agent
- Improve visual documentation for better understanding of task functionalities
- Add JavaScript code snippet demonstrating header extraction and request transformation for GitHub events
- Improve documentation clarity on how to bridge GitHub event formats with Trigger.dev expectations
…terminology

- Revise section on routing patterns to enhance understanding of task routing and edge processing
- Clarify the role of the transform in adapting GitHub event formats for Trigger.dev
- Update headings and descriptions for consistency and better readability
- Add Trigger.dev CLI login as a prerequisite and inline prompt before
  deploy step (npx trigger.dev@latest login required before npm run deploy)
- Clarify GITHUB_WEBHOOK_SECRET is user-chosen, suggest openssl rand -hex 32

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…plicates

On each push to a PR, handle-pr now finds the existing AI review comment
(identified by an invisible HTML marker) and updates it in place rather
than posting a new comment each time. Adds findExistingComment and
updateComment helpers to github.ts.

Updates GUIDE.md to document the upsert behaviour and updated code snippet.
2-3 minute talking head + screen recording script covering both routing
patterns, with demo script usage notes and production guidance.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Move the video script to walkthrough/README.md, add bash helpers next to it,
point demo:* npm scripts at walkthrough/*.sh, and link from the package README.
Ignore .plan/ for local planning notes.

Made-with: Cursor
…rams

Tutorial now lives on the Hookdeck site. Production notes reference
README.md Mermaid diagrams instead of the removed in-repo guide.

Made-with: Cursor
@leggetter leggetter marked this pull request as ready for review March 30, 2026 12:40
@leggetter
Copy link
Copy Markdown
Collaborator Author

leggetter commented Mar 30, 2026

AI Review Summary

Summary

This PR adds a comprehensive GitHub AI agent demo showcasing integration between Hookdeck (for webhook routing) and Trigger.dev (for task execution). The demo implements three AI-powered workflows: PR review summaries, issue labeling, and deployment notifications to Slack, demonstrating two different routing patterns.

Key Observations

Strengths:

  • Excellent documentation with clear architecture diagrams and setup instructions
  • Demonstrates two distinct integration patterns (task router vs connection routing) with clear trade-offs
  • Comprehensive environment variable management with sync to production
  • Good security practices (webhook verification at Hookdeck, Bearer auth to Trigger.dev)
  • Includes demo scripts and walkthrough materials for easy testing
  • Well-structured codebase with shared utilities

Potential Concerns:

  • Dual processing risk: Setup creates both routing patterns simultaneously, which could lead to duplicate processing of the same GitHub events unless connections are manually disabled
  • Production-only deployment: No development/staging environment support, which limits testing flexibility
  • Environment variable complexity: Multiple similar variable names (GITHUB_TOKEN vs GITHUB_ACCESS_TOKEN) could cause confusion
  • Hard dependency on multiple external services: Requires accounts and setup for Hookdeck, Trigger.dev, Anthropic, and Slack

Suggestions for Improvement

  1. Address dual processing: Consider adding a setup flag to choose between routing patterns, or add clear warnings about disabling unused connections
  2. Add environment validation: Include a pre-setup script to validate all required environment variables are present and properly formatted
  3. Simplify deployment options: Consider adding a development mode or at least document the production-only limitation more prominently in the main README
  4. Error handling: The transformation and task code could benefit from more explicit error handling for API failures

This is a well-crafted demo that effectively showcases the integration patterns. The main concern is the potential for confusion around dual processing, but the documentation quality is excellent.


Generated by Hookdeck + Trigger.dev

- Paginate issue comments in findExistingComment; simplify handle-pr upsert (single HTML marker)
- README: two-layer verification (source HMAC + Bearer); drop stale verifyHookdeckEvent claims
- Remove unused verify-hookdeck.ts stub
- Stop tracking .plan collaboration build plan (keep local under .gitignore)

Made-with: Cursor
…EADME

- Add trigger-dev/ to repo layout and Hookdeck-adjacent Trigger.dev table row
- Align feature bullets (PR upsert, push branch default) with task code
- Remove stale transform/router verification wording; match trigger-wrapper.js
- Replace TODO with optional follow-ups for a complete demo

Made-with: Cursor
- Copy X-GitHub-Delivery into payload.github_delivery_id after body spread
- Router requires delivery id and uses global Trigger.dev idempotency keys per child task
- README: update shared trigger-wrapper when changing hookdeck/trigger-wrapper.js
- setup-hookdeck: note filtered connections reference named trigger-wrapper

Made-with: Cursor
@leggetter leggetter merged commit 24c1cb6 into main Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant