Skip use-hermes-nightly when hermes-compiler is already pinned (#56505)

Summary:
`use-hermes-nightly` unconditionally overwrites the `hermes-compiler` with whatever the `latest-v1` tag currently points to. On release branches, where `hermes-compiler` is pinned to a specific version, it replaces the pin. This doesn't cause an issue until the `latest-v1` tag moves off the pinned version.

Looks to have been introduced by https://github.com/facebook/react-native/issues/53837.

bypass-github-export-checks

## Changelog:

[INTERNAL] [FIXED] - Preserve pinned `hermes-compiler` version when running `use-hermes-nightly` on release branches.

Pull Request resolved: https://github.com/facebook/react-native/pull/56505

Test Plan: With `hermes-compiler` manually set to a real version, the script returns early without modifying `package.json` or `hermes-engine/version.properties`.

Reviewed By: cortinico

Differential Revision: D101633376

Pulled By: cipolleschi

fbshipit-source-id: 666baa1a7838272b18e326b8597394d66b81343c
This commit is contained in:
Alan Hughes authored and meta-codesync[bot] committed 2026-04-21 03:58:20 -07:00
1 parent fd082b938b
commit 70281d6d0e
1 file changed
+11
+11
View File
@@ -10,9 +10,20 @@
'use strict';
const {getReactNativePackage} = require('../shared/monorepoUtils');
const {updateHermesVersionsToNightly} = require('./utils/hermes-utils');
async function main() {
const {packageJson} = await getReactNativePackage();
const hermesCompilerVersion = packageJson.dependencies?.['hermes-compiler'];
if (hermesCompilerVersion != null && hermesCompilerVersion !== '0.0.0') {
console.log(
`Skipping hermes nightly update: hermes-compiler is pinned to ${hermesCompilerVersion}`,
);
return;
}
await updateHermesVersionsToNightly();
}