feat(sync-snippets): add raw-files target for manifest-driven consumers#83
Merged
Conversation
Consumers that import snippet text via Vite's `?raw` import (e.g. gonfalon's `packages/sdk-info/`) need flat .txt files on disk, not marker comments embedded in source. The CLI's `raw-files` adapter already drives that mode; expose it through the action by accepting a `manifest:` input alongside the existing `entrypoints:` and dispatching on `target:`. - target=ld-application | ld-docs: requires entrypoints (existing behavior). - target=raw-files: requires manifest, ignores entrypoints with a warning. - Unknown target: error. entrypoints: is now optional at the schema level; the per-target validation rules live in the run script so the error message names the missing input concretely. README updated with both call shapes.
6 tasks
The Resolve-tag step piped `gh release list` output through `head -n 1` to pick the most recent `snippets/*` tag. Under `set -o pipefail`, when `head` closes the pipe after reading its one line, `gh` exits 141 on its next write, propagating to the subshell and failing the step. Whether `gh` finishes writing before `head` closes is a buffering race — fine when the API response fits in the kernel pipe buffer, broken otherwise. Recently observed in learn-release-please's parallel sync jobs: sync-raw won the race, sync lost it on the same workflow run. Move the first-match selection into jq itself (`map(... | select(...)) | first // empty`) so there's no `head` and no pipe closing early. `first` returns null when nothing matches; `// empty` makes that print as "" so the existing `if [ -z "$tag" ]` check still fires for the genuine "no releases" case.
v7.x runs on Node 20, which is deprecated on GitHub Actions runners (forced to Node 24 starting June 2nd, 2026; removed September 16th, 2026). v8.0.0 (Dec 2025) bumped the action to Node 24; no breaking changes affect our usage. Pinned by commit SHA per the rest of this repo's convention.
keelerm84
approved these changes
May 4, 2026
kinyoklion
added a commit
that referenced
this pull request
May 4, 2026
The sync-snippets composite action shipped in #82 and #83 but wasn't added to release-please-config.json, so it stays at "main" forever without a versioned tag. Consumers like gonfalon's sync-sdk-info-snippets.yml currently pin by full commit SHA — they should be able to pin to e.g. sync-snippets-v1 once a release lands. Adds the package to release-please-config.json (simple release-type, matching the rest of the actions) and seeds the manifest at 0.0.0 so release-please opens its first release PR off the existing conventional-commit history.
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.
Summary
Extends the
sync-snippetscomposite action to support theraw-filesadapter target alongside the existing marker-driven (ld-application,ld-docs) targets.Consumers that import snippet text via Vite's
?rawimport (e.g. gonfalon'spackages/sdk-info/) need flat.txtfiles on disk, not marker comments embedded in source code — there's no marker to anchor a renderer to. The CLI'sraw-filesadapter (inlaunchdarkly/sdk-meta) already drives that mode via a YAML manifest the consumer commits; this PR just exposes it through the action.Behavior
target: ld-application|target: ld-docs— requiresentrypoints:(existing behavior, unchanged).target: raw-files— requiresmanifest:, ignoresentrypoints:with a warning.target:— fails with a clear error.entrypoints:is now optional at the schema level so atarget=raw-filesworkflow doesn't have to pass an empty string; per-target validation lives in the run script so the error names the missing input concretely.Test plan
snippets render --target=raw-files --manifest=packages/sdk-info/extract.yamlagainst the releasedsnippets/v0.2.1binary, confirm the renderedpackages/sdk-info/src/snippets/tree matches the canonical sdk-meta source byte-for-byte.