OSS CI: skip bundle size reporting for *-stable branches

Summary:
The size information is currently not used for release branches. Further, the CI step failed because there is no PR associated with commits in RC branch. This commit fixed that error by skipping the entire work altogether.

Sample error: https://app.circleci.com/pipelines/github/facebook/react-native/10161/workflows/3625732a-531f-435d-83b6-1dbc638e1bab/jobs/215405/parallel-runs/0/steps/0-125

In theory, we should be storing RC bundle sizes as well, but the current backing Firebase DB has not been configured with proper index:

```
Error [FirebaseError]: The query requires an index.

...
```

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D31705912

fbshipit-source-id: 26757174f7937cb23d8e55066b833ae15ec011e3
This commit is contained in:
Kevin Gozali
2021-10-15 18:06:43 -07:00
parent ed8e5e5151
commit 07c454b2d2
+3
View File
@@ -47,6 +47,7 @@ async function reportSizeStats(stats, replacePattern) {
);
const collection = datastore.getBinarySizesCollection(store);
// Collect the current sizes for main branch only.
if (GITHUB_REF === 'main') {
// Ensure we only store numbers greater than zero.
const validatedStats = Object.keys(stats).reduce((validated, key) => {
@@ -65,6 +66,8 @@ async function reportSizeStats(stats, replacePattern) {
validatedStats,
);
}
} else if (GITHUB_REF.endsWith('-stable')) {
console.log(`Skipping bundle size reporting for branch: ${GITHUB_REF}`);
} else {
const document = await datastore.getLatestDocument(collection);