Add intelligent trigger system for demo generation #32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # GitGlimpse E2E Demo Workflow | |
| # Runs the action against a local example app on every PR. | |
| # Safe: no untrusted user input (PR titles/bodies) is used in run: commands. | |
| name: GitGlimpse Demo | |
| on: | |
| pull_request: | |
| types: [opened, synchronize] | |
| issue_comment: | |
| types: [created] | |
| jobs: | |
| demo: | |
| runs-on: ubuntu-latest | |
| # Run on PR events, or on issue_comment only if it's a PR comment containing /glimpse | |
| if: >- | |
| github.event_name == 'pull_request' || | |
| (github.event_name == 'issue_comment' && | |
| github.event.issue.pull_request && | |
| contains(github.event.comment.body, '/glimpse')) | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # On issue_comment, check out the PR head ref (default branch otherwise has no trigger code) | |
| ref: ${{ github.event_name == 'issue_comment' && format('refs/pull/{0}/head', github.event.issue.number) || '' }} | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - uses: pnpm/action-setup@v4 | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Install FFmpeg | |
| run: sudo apt-get install -y ffmpeg | |
| - name: Install Playwright Chromium | |
| run: pnpm --filter @git-glimpse/core exec playwright install chromium --with-deps | |
| - name: Start example app | |
| run: node examples/simple-app/server.js & | |
| - name: Wait for app to be ready | |
| run: | | |
| for i in $(seq 1 15); do | |
| curl -sf http://localhost:3000 && echo "App ready" && exit 0 | |
| echo "Waiting... ($i)" | |
| sleep 1 | |
| done | |
| echo "App did not become ready" && exit 1 | |
| - uses: ./packages/action | |
| with: | |
| preview-url: 'http://localhost:3000' | |
| config-path: examples/simple-app/git-glimpse.config.ts | |
| env: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |