Fix xplat sync to ignore @generated header (#29738)
Use some clever git diffing to ignore lines that only change the `@generated` header. We can't do this for the version string because the version string can be embedded in lines with other changes, but this header is always on one line.
Ricky committed
Jun 3, 2024 at 16:39 UTC
8c3697a849b7e9ceeb47642ba61c270b7e6dd176
2 files changed
+12
-1
.github/workflows/commit_artifacts.yml
+3
-1
@@ -329,7 +329,9 @@ jobs:
329
git status
330
echo "===================="
331
echo "Checking for changes"
332
- if git status --porcelain | grep -qv '/REVISION'; then
332
+ # Check if there are changes in the files other than REVISION or @generated headers
333
+ # We also filter out the file name lines with "---" and "+++".
334
+ if git diff -- . ':(exclude)*REVISION' | grep -vE "^(@@|diff|index|\-\-\-|\+\+\+|@generated SignedSource)" | grep "^[+-]" > /dev/null; then
335
echo "Changes detected"
336
echo "should_commit=true" >> "$GITHUB_OUTPUT"
337
else
scripts/rollup/build-all-release-channels.js
+9
@@ -168,6 +168,15 @@ function processStable(buildDir) {
168
);
169
}
170
171
+ if (fs.existsSync(buildDir + '/facebook-react-native')) {
172
+ const versionString =
173
+ ReactVersion + '-native-fb-' + sha + '-' + dateString;
174
+ updatePlaceholderReactVersionInCompiledArtifacts(
175
+ buildDir + '/facebook-react-native',
176
+ versionString
177
+ );
178
+ }
179
+
180
// Now do the semver ones
181
const semverVersionsMap = new Map();
182
for (const moduleName in stablePackages) {