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.
This commit is contained in:
Ricky
2024-06-03 16:39:38 -04:00
committed by GitHub
parent a0e8566357
commit 4ceac5204c
2 changed files with 12 additions and 1 deletions
+3 -1
View File
@@ -329,7 +329,9 @@ jobs:
git status
echo "===================="
echo "Checking for changes"
if git status --porcelain | grep -qv '/REVISION'; then
# Check if there are changes in the files other than REVISION or @generated headers
# We also filter out the file name lines with "---" and "+++".
if git diff -- . ':(exclude)*REVISION' | grep -vE "^(@@|diff|index|\-\-\-|\+\+\+|@generated SignedSource)" | grep "^[+-]" > /dev/null; then
echo "Changes detected"
echo "should_commit=true" >> "$GITHUB_OUTPUT"
else
@@ -168,6 +168,15 @@ function processStable(buildDir) {
);
}
if (fs.existsSync(buildDir + '/facebook-react-native')) {
const versionString =
ReactVersion + '-native-fb-' + sha + '-' + dateString;
updatePlaceholderReactVersionInCompiledArtifacts(
buildDir + '/facebook-react-native',
versionString
);
}
// Now do the semver ones
const semverVersionsMap = new Map();
for (const moduleName in stablePackages) {