Skip to content

Commit fc5c8d0

Browse files
Merge pull request #22 from DeDuckProject/fix/glimpse-uses-pr-branch-code
fix: build action from source so /glimpse uses PR branch code
2 parents 2c152d6 + 25cb939 commit fc5c8d0

5 files changed

Lines changed: 18 additions & 44 deletions

File tree

.github/workflows/demo.yml

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# GitGlimpse E2E Demo Workflow
22
# Runs the action against a local example app on every PR.
33
# Safe: no untrusted user input (PR titles/bodies) is used in run: commands.
4+
#
5+
# ⚠️ IMPORTANT — changes to this file only take effect after merging to main.
6+
#
7+
# GitHub always reads issue_comment workflows from the default branch (main),
8+
# so edits to this file on a feature branch are silently ignored when /glimpse
9+
# is triggered. To test a workflow change: merge to main first, then re-run.
10+
# (Action/core code changes are fine on branches — they are rebuilt from source.)
411
name: GitGlimpse Demo
512

613
on:
@@ -28,13 +35,6 @@ jobs:
2835
fetch-depth: 0
2936
ref: ${{ github.event_name == 'issue_comment' && format('refs/pull/{0}/head', github.event.issue.number) || '' }}
3037

31-
# On issue_comment we check out the PR head (for app code), but need
32-
# the action from main (which has trigger support). The bundled dist
33-
# includes all core logic, so restoring just packages/action/ suffices.
34-
- name: Use latest action code from main
35-
if: github.event_name == 'issue_comment'
36-
run: git checkout origin/main -- packages/action/
37-
3838
- uses: pnpm/action-setup@v4
3939

4040
- uses: actions/setup-node@v4
@@ -45,6 +45,12 @@ jobs:
4545
- name: Install dependencies
4646
run: pnpm install
4747

48+
# Always build from source so the action dist matches the checked-out code.
49+
# This ensures /glimpse on a PR branch uses that branch's action/core code,
50+
# not whatever was last committed to dist or published to main.
51+
- name: Build action from source
52+
run: pnpm build
53+
4854
# Check whether the pipeline should run before installing heavy dependencies.
4955
# Subsequent steps are gated on this output to skip ffmpeg/Playwright when
5056
# the trigger config (on-demand, smart, etc.) decides to skip the run.
@@ -93,12 +99,3 @@ jobs:
9399
env:
94100
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
95101
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
96-
GG_DEBUG_TRACE: '1'
97-
98-
- name: Upload Playwright trace
99-
if: always() && steps.check.outputs.should-run == 'true'
100-
uses: actions/upload-artifact@v4
101-
with:
102-
name: playwright-trace
103-
path: ./recordings/trace.zip
104-
if-no-files-found: ignore

packages/action/dist/index.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41907,10 +41907,6 @@ async function runScriptAndRecord(options) {
4190741907
const startTime = Date.now();
4190841908
try {
4190941909
const context2 = await createContext(browser, recording, outputDir);
41910-
const enableTrace = process.env["GG_DEBUG_TRACE"] === "1";
41911-
if (enableTrace) {
41912-
await context2.tracing.start({ screenshots: true, snapshots: true, sources: false });
41913-
}
4191441910
const page = await context2.newPage();
4191541911
if (recording.showMouseClicks !== false) {
4191641912
page.on("load", () => {
@@ -41924,15 +41920,10 @@ async function runScriptAndRecord(options) {
4192441920
if (elapsed > recording.maxDuration) {
4192541921
console.warn(`Demo exceeded max duration (${elapsed.toFixed(1)}s > ${recording.maxDuration}s)`);
4192641922
}
41927-
let tracePath;
41928-
if (enableTrace) {
41929-
tracePath = (0, import_node_path.join)(outputDir, "trace.zip");
41930-
await context2.tracing.stop({ path: tracePath });
41931-
}
4193241923
await context2.close();
4193341924
const videoPath = await resolveVideoPath(outputDir);
4193441925
const duration = (Date.now() - startTime) / 1e3;
41935-
return { videoPath, duration, tracePath };
41926+
return { videoPath, duration };
4193641927
} finally {
4193741928
await browser.close();
4193841929
}
@@ -42258,8 +42249,7 @@ async function runPipeline(options) {
4225842249
path: processed.outputPath,
4225942250
format: processed.format,
4226042251
duration: recordingResult.duration,
42261-
sizeMB: processed.sizeMB,
42262-
tracePath: recordingResult.tracePath
42252+
sizeMB: processed.sizeMB
4226342253
},
4226442254
script,
4226542255
analysis,

packages/action/dist/index.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/src/pipeline.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export interface DemoResult {
2424
format: string;
2525
duration: number;
2626
sizeMB: number;
27-
tracePath?: string;
2827
};
2928
screenshots?: string[];
3029
script: string;
@@ -112,7 +111,6 @@ export async function runPipeline(options: PipelineOptions): Promise<DemoResult>
112111
format: processed.format,
113112
duration: recordingResult.duration,
114113
sizeMB: processed.sizeMB,
115-
tracePath: recordingResult.tracePath,
116114
},
117115
script,
118116
analysis,

packages/core/src/recorder/playwright-runner.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import type { RecordingConfig } from '../config/schema.js';
66
export interface RecordingResult {
77
videoPath: string;
88
duration: number;
9-
tracePath?: string;
109
}
1110

1211
export interface RunScriptOptions {
@@ -28,10 +27,6 @@ export async function runScriptAndRecord(options: RunScriptOptions): Promise<Rec
2827

2928
try {
3029
const context = await createContext(browser, recording, outputDir);
31-
const enableTrace = process.env['GG_DEBUG_TRACE'] === '1';
32-
if (enableTrace) {
33-
await context.tracing.start({ screenshots: true, snapshots: true, sources: false });
34-
}
3530
const page = await context.newPage();
3631

3732
// Inject the cursor overlay after every page load (fires after app JS/hydration
@@ -53,18 +48,12 @@ export async function runScriptAndRecord(options: RunScriptOptions): Promise<Rec
5348
console.warn(`Demo exceeded max duration (${elapsed.toFixed(1)}s > ${recording.maxDuration}s)`);
5449
}
5550

56-
let tracePath: string | undefined;
57-
if (enableTrace) {
58-
tracePath = join(outputDir, 'trace.zip');
59-
await context.tracing.stop({ path: tracePath });
60-
}
61-
6251
await context.close();
6352

6453
const videoPath = await resolveVideoPath(outputDir);
6554
const duration = (Date.now() - startTime) / 1000;
6655

67-
return { videoPath, duration, tracePath };
56+
return { videoPath, duration };
6857
} finally {
6958
await browser.close();
7059
}

0 commit comments

Comments
 (0)