feat(ci): auto-sync example repos on release - #475
Merged
Conversation
Add scripts/sync-examples.ts + .github/workflows/sync-examples.yml: on each published release, regenerate every the-craftlab/pipecraft-example-* repo with the new generator and open a PR per repo that drifted (the remote example also gets its actionVersion bumped to the release tag). Repos already in sync are skipped; without --push the script reports drift only (dry run). Reuses the flavor model from scripts/e2e/flavors.ts. Runs locally too: pnpm sync-examples [--version <tag>] [--push] <flavor|all> The workflow needs an EXAMPLES_TOKEN secret (write + PR access to the example repos, which the default GITHUB_TOKEN lacks); without it the job no-ops with a clear message rather than failing the release. Validated live: dry-run detects drift correctly; --push opened a sync PR on the remote example bumping actionVersion to v0.42.0.
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
Closes the loop on keeping the live example repos current: on each published release, regenerate every
the-craftlab/pipecraft-example-*repo with the new generator and open a PR per repo that drifted. The remote example also gets itsactionVersionbumped to the release tag. Repos already in sync are skipped.Pieces
scripts/sync-examples.ts—pnpm sync-examples [--version <tag>] [--push] <flavor|all>. Clones each example repo, writes the canonicalexamples/<flavor>config, regenerates with the CLI, and (with--push) opens/updates apipecraft-sync/<tag>PR into the repo's initial branch. Without--pushit's a dry run that reports drift. Reuses the flavor model fromscripts/e2e/flavors.ts..github/workflows/sync-examples.yml— runs onrelease: published(andworkflow_dispatch).Required secret (the one manual step)
The workflow needs
EXAMPLES_TOKEN— a token with Contents: write + Pull requests: write on thepipecraft-example-*repos (the defaultGITHUB_TOKENonly reaches this repo). Use a fine-grained PAT, classic PAT (repo), or a GitHub App token. Without it the job no-ops with a warning rather than failing the release.Why PRs, not direct pushes
Each sync lands as a reviewable PR per example repo, so drift is visible and you decide when to merge (or enable auto-merge on those repos).
Validated live
actionVersionv0.41.1 → v0.42.0; library in sync).--pushopened a real sync PR on the remote example: chore: sync generated workflow to pipecraft v0.42.0 pipecraft-example-remote#6.Full suite green (585).
🤖 Generated with Claude Code