Skip to content

chore: CI build-example-matrix: replace lerna with node script#166

Open
X-Guardian wants to merge 2 commits intoopen-constructs:mainfrom
X-Guardian:chore/build-examples-matrix
Open

chore: CI build-example-matrix: replace lerna with node script#166
X-Guardian wants to merge 2 commits intoopen-constructs:mainfrom
X-Guardian:chore/build-examples-matrix

Conversation

@X-Guardian
Copy link
Copy Markdown
Contributor

@X-Guardian X-Guardian commented May 6, 2026

Description

Why

The build-example-matrix CI job currently runs npx lerna list to obtain a list of example projects to run the example integration tests on. Because a prior yarn install has not been run, npx doesn't use the lerna version pinned in this repo's package.json but resolves and downloads its own copy of the latest matching version every CI run. That means:

  • The matrix step depends on whatever lerna npx happens to fetch, not the version we've tested against.
  • A breaking change in upstream lerna (or in the nx plugin lerna 8 activates on invocation) could silently change matrix behaviour or fail the job entirely, with no lockfile change to flag it.
  • This is also susceptible to supply-chain attacks.

We could add a yarn install step, but this would add more runtime to the CI when it is not required.

Changes

  • Replace the inline npx lerna list … | jq … shell pipeline in .github/workflows/examples.yml with a single node tools/build-example-matrix.mjs invocation piped through tee -a $GITHUB_OUTPUT.
  • Add tools/build-example-matrix.mjs that walks examples/, reads each package.json, filters out private workspaces and emits the matrix as JSON.

The new script has no dependencies and produces the same output.

Checklist

  • I have updated the PR title to match CDKTN's style guide
  • I have run the linter on my code locally
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation if applicable
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works if applicable
  • New and existing unit tests pass locally with my changes

@X-Guardian X-Guardian marked this pull request as ready for review May 7, 2026 08:04
@X-Guardian X-Guardian requested a review from a team as a code owner May 7, 2026 08:04
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