Skip to content

feat(ci): auto-sync example repos on release - #475

Merged
jamesvillarrubia merged 1 commit into
developfrom
feat/sync-examples-ci
Jun 26, 2026
Merged

feat(ci): auto-sync example repos on release#475
jamesvillarrubia merged 1 commit into
developfrom
feat/sync-examples-ci

Conversation

@jamesvillarrubia

Copy link
Copy Markdown
Collaborator

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 its actionVersion bumped to the release tag. Repos already in sync are skipped.

Pieces

  • scripts/sync-examples.tspnpm sync-examples [--version <tag>] [--push] <flavor|all>. Clones each example repo, writes the canonical examples/<flavor> config, regenerates with the CLI, and (with --push) opens/updates a pipecraft-sync/<tag> PR into the repo's initial branch. Without --push it's a dry run that reports drift. Reuses the flavor model from scripts/e2e/flavors.ts.
  • .github/workflows/sync-examples.yml — runs on release: published (and workflow_dispatch).

Required secret (the one manual step)

The workflow needs EXAMPLES_TOKEN — a token with Contents: write + Pull requests: write on the pipecraft-example-* repos (the default GITHUB_TOKEN only 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

Full suite green (585).

🤖 Generated with Claude Code

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.
@jamesvillarrubia
jamesvillarrubia merged commit 6f06615 into develop Jun 26, 2026
15 checks passed
@jamesvillarrubia
jamesvillarrubia deleted the feat/sync-examples-ci branch June 26, 2026 17:34
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.

1 participant