refactor: run action steps through the harness CLI - #185
Open
V3RON wants to merge 2 commits into
Open
Conversation
Move the GitHub Action's four bundled Node scripts into @react-native-harness/cli as `harness ci <subcommand>` and delete the committed bundles. The action now invokes the project's own installed react-native-harness binary instead of prebuilt .cjs files checked into the repository, so changes to config, cache, or platform-android no longer require rebuilding and committing ~628KB of bundled output.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
V3RON
marked this pull request as draft
August 13, 2026 09:54
V3RON
marked this pull request as ready for review
August 13, 2026 09:54
…n floor The action's react-native-harness compatibility check used a hard-coded MIN_VERSION compared via `sort -V`. That's unbootstrappable: it rejects the very release that introduces `harness ci` (this repo's own workspace packages carry the pre-release version until the release is cut), and `sort -V` also ranks prereleases of a compatible release below it. Replace the version floor with an explicit `harnessActionProtocol` marker on the `react-native-harness` package.json, which the action reads via the same `require.resolve` call it already makes. The two packages release in lockstep via `workspace:*`, so the marker can't drift from the CLI it describes, and the guard still fails fast (without ever invoking `harness ci` itself) when a project's installed CLI predates the CLI-based action.
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.
What is this?
The React Native Harness GitHub Action no longer ships bundled JavaScript. Its four Node steps — config loading and the three Metro cache planning steps — now run through the
react-native-harnessCLI already installed in the project under test, via a newharness ci <subcommand>command group.Previously those steps ran prebuilt
actions/shared/*.cjsfiles committed to the repository. Because the bundler inlined@react-native-harness/config,@react-native-harness/cache, and@react-native-harness/platform-android, any change to those packages rewrote roughly 628KB of committed output across four near-identical bundles. Contributors had to remember to rebuild and commit them, and regularly did not.How does it work?
harness ciexposesload-config,plan-metro-restore,snapshot-metro, andplan-metro-save, each a direct move of the corresponding action script with its environment-variable andGITHUB_OUTPUTcontract unchanged. The composite action calls them through the detected package manager, the same way it already invokes the CLI to run tests, so the scripts now come from the same package version that will run the suite rather than from a snapshot pinned to the action ref.Two ordering changes support this. Package manager detection moves to the first step, since it is needed to invoke the CLI at all. A version guard follows it: on a CLI predating
harness ci, the subcommand would fall through to the Jest CLI and be read as a test path pattern, so the action resolves the installed version up front and fails with an explicit message when it is missing or older than the release that introduces the command.Because those steps now run with
working-directoryset to the project root, path handling is anchored toGITHUB_WORKSPACErather than the current directory.INPUT_PROJECTROOTand the emittedprojectRootstay relative to the checkout root, which is whatactions/cache,actions/upload-artifact, andhashFiles(...)resolve against regardless of a step's working directory.The
@react-native-harness/github-actionpackage and theactions/directory are removed, and its README moves todocs/github-action.md.packages/cligains a test target it previously lacked, so the moved cache tests and the package's two existing suites now run in CI.Why is this useful?
No generated code remains in the repository, so the rebuild-and-commit step disappears along with the class of pull request that silently ships a stale bundle. Changes to config parsing or cache key computation take effect through the normal package graph, and reviewers see the actual diff instead of hundreds of kilobytes of bundler output. Consumers of the action get scripts that match their installed Harness version, with a clear failure when the two drift apart.