Skip to content

Add intelligent trigger system for demo generation#4

Merged
DeDuckProject merged 5 commits intomainfrom
claude/optimize-pipeline-triggers-L1uZG
Mar 12, 2026
Merged

Add intelligent trigger system for demo generation#4
DeDuckProject merged 5 commits intomainfrom
claude/optimize-pipeline-triggers-L1uZG

Conversation

@DeDuckProject
Copy link
Copy Markdown
Owner

Summary

This PR introduces a comprehensive trigger system that intelligently decides when to run the demo generation pipeline. It adds support for multiple trigger modes (auto, on-demand, smart), comment-based commands, file filtering with glob patterns, and change magnitude thresholds.

Key Changes

Trigger Modes

  • auto: Runs on every PR that touches UI files (default)
  • on-demand: Only runs when explicitly triggered via /glimpse comment command
  • smart: Runs only when UI changes exceed a configurable threshold (lines changed)

Comment Command Support

  • Added /glimpse command parsing with support for flags:
    • --force: Override all filters and thresholds
    • --route /path: Specify a route to demo (parsed but not yet used)
  • Action now listens to issue_comment events in addition to pull_request events
  • Acknowledges commands with an "eyes" reaction on the comment

File Filtering

  • New filterUIFiles() function supports glob-based include/exclude patterns
  • Falls back to built-in isUIFile() heuristic when no patterns are configured
  • Allows explicit inclusion of non-UI files (e.g., server routes) via config

Change Magnitude Calculation

  • Added computeChangeMagnitude() to sum additions and deletions across files
  • Used in "smart" mode to skip trivial changes below a threshold

Configuration

  • New TriggerConfig schema with sensible defaults
  • Configurable via git-glimpse.config.ts or GitHub Actions input trigger-mode
  • Skip comment feature: posts a comment explaining why the pipeline was skipped

Skip Comments

  • New postSkipComment() function posts/updates a comment when pipeline is skipped
  • Helps users understand why their PR didn't trigger a demo and how to force one

Implementation Details

  • Trigger decision logic is centralized in evaluateTrigger() with clear precedence:
    1. Force flag always wins
    2. Comment events always run (unless no command found)
    3. On-demand mode blocks auto-triggers
    4. File filters applied
    5. Smart mode threshold checked
  • Comprehensive unit tests cover all trigger modes, file filters, and command parsing
  • Action refactored to handle both pull_request and issue_comment events with proper PR resolution for comments

https://claude.ai/code/session_01F7qRXukhynYjUukzhaBzSK

claude added 2 commits March 11, 2026 19:31
…command

Introduces a trigger config section to git-glimpse.config.ts that controls
when and whether the demo pipeline fires, reducing unnecessary LLM/Playwright
resource usage on PRs that don't affect UI.

- Three modes: auto (default), on-demand, smart (threshold-based)
- User-configurable include/exclude glob patterns replace hardcoded isUIFile heuristics
- /glimpse PR comment command for on-demand triggering (supports --force and --route flags)
- action/src/index.ts now handles both pull_request and issue_comment events
- Posts a skip comment with explanation and /glimpse hint when pipeline is skipped
- 29 new unit tests covering command parser, file filter, and trigger decision logic

https://claude.ai/code/session_01F7qRXukhynYjUukzhaBzSK
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 11, 2026

GitGlimpse — Skipped

On-demand mode is enabled. Comment /glimpse on this PR to generate a demo.


Generated by git-glimpse

Configure the example app to use trigger.mode: 'on-demand' so the pipeline
only runs when /glimpse is commented on a PR. Added issue_comment event
to the demo workflow to support this.

https://claude.ai/code/session_01F7qRXukhynYjUukzhaBzSK
@DeDuckProject
Copy link
Copy Markdown
Owner Author

/glimpse

On issue_comment events, GitHub checks out the default branch by default,
which doesn't have the trigger code. Now we explicitly check out the PR
head ref. Also added a job-level `if` guard to skip non-PR comments and
comments that don't contain /glimpse.

https://claude.ai/code/session_01F7qRXukhynYjUukzhaBzSK
@DeDuckProject
Copy link
Copy Markdown
Owner Author

/glimpse

@DeDuckProject
Copy link
Copy Markdown
Owner Author

/glimpse

@DeDuckProject DeDuckProject merged commit d86e512 into main Mar 12, 2026
3 checks passed
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.

2 participants