ci: build wasm compiler during docs deployment to fix live editor#16406
ci: build wasm compiler during docs deployment to fix live editor#16406
Conversation
The live editor at /gh-aw/editor/ fails with "Failed to execute 'importScripts' on 'WorkerGlobalScope'" because wasm_exec.js and gh-aw.wasm are gitignored build artifacts that were never built during the docs deployment pipeline. Add Go setup and scripts/bundle-wasm-docs.sh to the docs workflow so the WebAssembly compiler is built and placed in docs/public/wasm/ before the Astro build. Also expand path triggers to rebuild docs when wasm-related source files change. Supersedes #16306. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Updates the docs deployment workflow to ensure the WebAssembly compiler artifacts needed by the live editor are built and included in the published Astro site.
Changes:
- Expand
pull_request/pushpath filters to rebuild docs when WASM-related Go code changes. - Add Go toolchain setup to the docs workflow.
- Run the WASM bundling script before the Astro build so
docs/public/wasm/has the required artifacts at build time.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| pull_request: | ||
| paths: | ||
| - 'docs/**' | ||
| - 'cmd/gh-aw-wasm/**' | ||
| - 'pkg/**' | ||
| - 'scripts/bundle-wasm-docs.sh' |
There was a problem hiding this comment.
The pull_request.paths / push.paths filters don’t include this workflow file itself. As a result, a PR that only changes .github/workflows/docs.yml (like this one) won’t trigger the docs build, which makes it hard to validate the workflow changes. Consider adding .github/workflows/docs.yml to both path lists.
| - 'cmd/gh-aw-wasm/**' | ||
| - 'pkg/**' | ||
| - 'scripts/bundle-wasm-docs.sh' | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - 'docs/**' | ||
| - 'cmd/gh-aw-wasm/**' | ||
| - 'pkg/**' | ||
| - 'scripts/bundle-wasm-docs.sh' |
There was a problem hiding this comment.
The path filters were expanded for Go/WASM-related changes, but they still won’t trigger on dependency/build-definition changes in the repo root (e.g. go.mod, go.sum, or Makefile). Since the WASM artifacts are produced via make build-wasm and depend on module state, consider adding these root files to both pull_request.paths and push.paths so docs rebuild when the WASM build inputs change.
- Add .github/workflows/docs.yml itself so workflow changes trigger CI - Add go.mod, go.sum, Makefile so dependency/build changes trigger rebuild Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
/gh-aw/editor/is broken on the deployed docs site becausewasm_exec.jsandgh-aw.wasmare gitignored build artifacts that were never built during the docs deployment pipelineimportScripts('./wasm_exec.js')fails withNetworkErrorbecause the file does not exist on the deployed sitescripts/bundle-wasm-docs.shto the docs workflow so the WebAssembly compiler is built and placed indocs/public/wasm/before the Astro buildcmd/gh-aw-wasm/**,pkg/**, andscripts/bundle-wasm-docs.shso Go changes affecting the wasm build trigger a docs rebuildSupersedes #16306.
Root cause analysis
The editor page loads
compiler-loader.jswhich spawns a Web Worker fromcompiler-worker.js. The worker callsimportScripts('./wasm_exec.js')which resolves to/gh-aw/wasm/wasm_exec.js. Bothwasm_exec.jsandgh-aw.wasmare generated byscripts/bundle-wasm-docs.sh(which invokesmake build-wasm) and are listed in.gitignore. The docs deployment workflow (docs.yml) was only runningnpm run buildwithout first building the wasm artifacts, so the deployed site was missing these files entirely.Test plan
cmd/gh-aw-wasm/,pkg/, orscripts/bundle-wasm-docs.shbundle-wasm-docs.shruns before the Astro build🤖 Generated with Claude Code