.github/workflows/ui-preview.yml, on pull_request_target or by hand (-f pr=N): detect (internal/gui/assets/, the GUI's non-test Go, or the ui-preview label) puts a "recording" note in the block; record, behind the ui-preview environment's approval since PRs come from forks, builds the PR's magpie (nogui), runs `magpie web` in a fresh home with DeepSeek added and a few requests sent through the gateway, and has DeepSeek plan from the diff and the pages' real outlines what to click and capture (record.mjs, Chromium at 2x, cursor.js drawing the mouse); publish, which never runs the PR's code, puts the files on the ui-previews branch served by Pages and rewrites only the block between <!-- magpie-ui-preview:begin/end --> — the video's poster links to its player page, since GitHub embeds no video it didn't host. Captions say what is being done, never what should come of it. Anything on screen matching the key or the web link's key throws the whole recording away. Tested locally with run.sh on 033a151's diff in a sandbox home: 3 screenshots and a 16 s mp4 of the Codex model list's 全部隐藏/全部显示, pointer, trail and clicks visible; actionlint passes. Not yet run on GitHub.
UI preview
.github/workflows/ui-preview.yml shows reviewers what a pull request does to the UI.
When a PR touches internal/gui/assets/ or the GUI's Go code, or carries the ui-preview label, the workflow does this:
- publish.mjs detect decides whether the PR is a UI change. It puts a "recording…" note in a fixed block at the foot of the PR description, between
<!-- magpie-ui-preview:begin -->and<!-- magpie-ui-preview:end -->. - run.sh builds the PR's magpie (nogui) and runs
magpie webin a fresh home, with DeepSeek added as a real provider. It sends a few requests through the gateway so Routing and Usage aren't empty, then runs: - record.mjs, which:
- gives DeepSeek the diff and outlines of the real pages;
- has it plan scenes: what to click, hover, type and capture;
- walks the plan in Chromium at 2x, with
cursor.jsdrawing the pointer, its trail and each click. It always takes screenshots. When the change spans pages or needs interaction, it also records an mp4, never a GIF. If the key shows up on screen at any point, everything is thrown away.
- publish.mjs publish puts the files under
pr-<n>/<sha>/on theui-previewsbranch, which GitHub Pages serves, and rewrites the block in the description:- the video's poster links to the player page, since GitHub won't embed a video it didn't host;
- the screenshots are shown inline.
Security: PRs come from forks, so the recording job waits for a maintainer's approval (environment ui-preview, which holds DEEPSEEK_API_KEY). Read the diff before approving. That job has no write access, and the job that writes never runs the PR's code.
To run it locally (run.sh builds and starts magpie itself):
cd .github/ui-preview && npm install && npx playwright install chromium
DEEPSEEK_API_KEY=… DIFF_FILE=pr.diff PR_TITLE=… ./run.sh ../.. /tmp/out
To re-run it for a PR, use gh workflow run ui-preview.yml -f pr=<n>.