Skip to content

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

Draft
leggetter wants to merge 14 commits intomainfrom
feat/trigger-dev-github-ai-agent
Draft

feat(trigger-dev): GitHub AI agent demo (Hookdeck + Trigger.dev)#6
leggetter wants to merge 14 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 14 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.
@leggetter
Copy link
Copy Markdown
Collaborator Author

leggetter commented Mar 27, 2026

AI Review Summary

Summary

This PR introduces a comprehensive GitHub AI agent demo that integrates Hookdeck and Trigger.dev. It sets up automated workflows for PR code reviews, issue labeling, and deployment notifications using Claude AI, with interactive setup scripts and production deployment capabilities.

Key Observations

Strengths:

  • Comprehensive automation: The setup scripts handle the entire deployment pipeline from Trigger.dev tasks to GitHub webhook registration
  • Two architectural patterns: Demonstrates both fan-out routing (single task router) and edge routing (Hookdeck filters), giving users flexibility
  • Production-ready verification chain: Implements proper HMAC verification at Hookdeck source → Bearer auth to Trigger.dev → task-level verification
  • Real AI functionality: Uses Claude for actual PR reviews, issue labeling, and deployment summaries rather than trivial examples
  • Good developer experience: Interactive setup with .env configuration and idempotent scripts

Potential Concerns:

  • Large diff scope: This is a substantial addition (~962 line build plan + full implementation) that would benefit from being split into smaller, reviewable chunks
  • Production-only deployment: The demo deploys directly to Trigger.dev production rather than dev environment, which could be surprising for users expecting to test locally first
  • Complex setup dependencies: Requires accounts and API keys for 5 different services (Hookdeck, Trigger.dev, GitHub, Anthropic, Slack)
  • Draft PR handling: The notes mention draft PRs still trigger AI reviews unless filtered in code, but this filtering isn't clearly implemented

Suggestions for Improvement

  1. Break up the PR: Consider splitting into logical chunks (setup scripts, task implementations, documentation) for easier review
  2. Add dev environment option: Include instructions or scripts for local development using npx trigger.dev@latest dev
  3. Improve error handling: The setup scripts should validate prerequisites and provide clear error messages when API keys are missing or invalid
  4. Add draft PR filtering: Implement the mentioned draft PR filtering in the task code to avoid unnecessary AI review runs
  5. Consider rate limiting: Add guidance on GitHub API rate limits and Anthropic API usage limits for the AI calls

The core architecture and implementation look solid - this addresses a real developer need with a thoughtful technical approach.


Generated by Hookdeck + Trigger.dev

@leggetter
Copy link
Copy Markdown
Collaborator Author

AI Review Summary

Summary

This pull request adds a comprehensive GitHub AI agent demo showcasing Hookdeck + Trigger.dev integration. It includes interactive setup scripts, webhook handling improvements, production deployment automation, and detailed documentation for building AI-powered GitHub automation workflows.

Key Observations

Strengths:

  • Excellent developer experience: The setup automation (npm run setup) handles the entire flow from deployment to webhook registration
  • Comprehensive documentation: Detailed build plan and guide demonstrate thorough planning and execution
  • Two architectural patterns: Shows both single-task fan-out and per-event routing approaches with clear trade-offs
  • Real-world utility: AI-powered PR reviews, issue labeling, and Slack notifications are genuinely useful features
  • Proper security: Implements webhook verification chain (GitHub HMAC → Hookdeck verification → task-level checks)

Potential Concerns:

  • Large changeset: 962 lines in the build plan alone makes this difficult to review thoroughly
  • Production-only deployment: No development/staging environment support could make debugging harder
  • Complex setup dependencies: Requires accounts and API keys for 5+ services (GitHub, Hookdeck, Trigger.dev, Anthropic, Slack)
  • Draft PR behavior: The note about draft PRs still triggering AI reviews could lead to unnecessary API usage

Suggestions for Improvement

  1. Consider development mode: Add support for npx trigger.dev@latest dev workflow alongside production deployment for easier local testing

  2. Add validation guards: The setup scripts should validate API keys and connectivity before creating resources

  3. Handle draft PRs: Add explicit filtering for pull_request.draft in the PR handler to avoid reviewing incomplete work

  4. Simplify for initial adoption: Consider a minimal version with fewer dependencies (maybe start with just issue labeling) and build up complexity

  5. Add cleanup scripts: Include teardown functionality to remove webhooks and Hookdeck connections when experimenting

The demo showcases excellent integration patterns and would be valuable for developers building webhook-driven automation. The automation and documentation quality are impressive.


Generated by Hookdeck + Trigger.dev

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