Repository navigation
Generate and comment new playground link when a PR includes a changed form - #47
Merged
joshunrau merged 5 commits intoSep 16, 2026
Merged
Conversation
joshunrau
approved these changes
Sep 16, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Form preview links for pull requests
Adds a GitHub Action that comments on every PR touching
lib/forms/**with an"Open in playground" link for each added or modified form, so reviewers can try
a form without checking it out.
How it works
pull_request_targetso the comment can be posted on PRs from forks.The workflow and script always come from the base branch; the PR's files
are only ever read as data via git objects — never checked out, installed,
or executed.
read straight from git objects, and a share link is generated for each.
hidden marker), so a PR never accumulates duplicate comments.
Link generation uses the official package
Share links are produced with
@opendatacapture/playground-url— the samelibrary the playground itself uses to encode and decode share URLs — rather than
a hand-rolled
lz-stringimplementation. This keeps us in lockstep with theplayground's format for free.
Because the package ships its importable entry as raw TypeScript (and relies on
a dependency it doesn't declare for external consumers), it can't be
importedfrom the plain-
nodeCI script. Its supported standalone interface is itscompiled CLI, so the script materializes each form's files into a throwaway
directory (read as data, never executed) and invokes the CLI to get the link.
Note: links now carry their payload in the URL hash fragment
(
#files=…) instead of the query string. This is the package's current format —it keeps the payload off the server (avoids
HTTP 431on large instruments),and the playground still reads the old query-string format, so links shared
before this change keep working.
Changes
.github/workflows/form-preview-links.yml— the workflow..github/scripts/form-preview-links.js— builds the comment; encodes linksvia
@opendatacapture/playground-url.package.json/pnpm-lock.yaml— drop the directlz-stringdependency,add
@opendatacapture/playground-url(which pulls inlz-stringtransitively).
pull_request_targetworkflows only trigger from the version of the workflow onthe repository's default branch (
main). This action therefore does nothinguntil this PR is merged — after which it fires automatically on every future PR
that touches
lib/forms/**. (This is GitHub's security model: the privileged,write-token workflow is trusted only from the default branch, so a PR can't
introduce or alter it.)
Verification
pnpm install --frozen-lockfile --ignore-scriptspasses (CI parity) andtscis clean.a valid playground link.
(via a temporary
pull_requesttrigger, not included here): the bot postedthe comment and the generated link opened the form in the playground.
🤖 Generated with Claude Code
Closes issue #46