Skip to content

feat(sync-snippets): add raw-files target for manifest-driven consumers#83

Merged
kinyoklion merged 3 commits into
mainfrom
rlamb/sync-snippets-manifest
May 4, 2026
Merged

feat(sync-snippets): add raw-files target for manifest-driven consumers#83
kinyoklion merged 3 commits into
mainfrom
rlamb/sync-snippets-manifest

Conversation

@kinyoklion
Copy link
Copy Markdown
Member

@kinyoklion kinyoklion commented May 1, 2026

Summary

Extends the sync-snippets composite action to support the raw-files adapter target alongside the existing marker-driven (ld-application, ld-docs) targets.

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 code — there's no marker to anchor a renderer to. The CLI's raw-files adapter (in launchdarkly/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 — requires entrypoints: (existing behavior, unchanged).
  • target: raw-files — requires manifest:, ignores entrypoints: with a warning.
  • Unknown target: — fails with a clear error.

entrypoints: is now optional at the schema level so a target=raw-files workflow 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

  • Action YAML parses (composite-action schema is line-validated by GitHub on push).
  • Local end-to-end against the sdkinfo branch in gonfalon: clone, run snippets render --target=raw-files --manifest=packages/sdk-info/extract.yaml against the released snippets/v0.2.1 binary, confirm the rendered packages/sdk-info/src/snippets/ tree matches the canonical sdk-meta source byte-for-byte.
  • Consumer workflow opens a sync PR when the manifest references a snippet whose body has changed upstream.

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.
@kinyoklion kinyoklion marked this pull request as ready for review May 1, 2026 23:58
@kinyoklion kinyoklion requested a review from a team as a code owner May 1, 2026 23:58
kinyoklion added 2 commits May 1, 2026 16:59
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.
@kinyoklion kinyoklion merged commit 653f554 into main May 4, 2026
2 checks passed
@kinyoklion kinyoklion deleted the rlamb/sync-snippets-manifest branch May 4, 2026 16:33
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants