chore(flakiness): limit max builds to 100 (#4818)

This was missing in #4808
This commit is contained in:
Andrey Lushnikov 2019-08-08 15:15:33 -07:00 committed by GitHub
parent f753ec6b04
commit 608b15f20d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,6 +18,7 @@ const RESET_COLOR = '\x1b[0m';
const DASHBOARD_VERSION = 1;
const DASHBOARD_FILENAME = 'dashboard.json';
const DASHBOARD_MAX_BUILDS = 100;
class FlakinessDashboard {
static async getCommitDetails(repoPath, ref = 'HEAD') {
@ -103,6 +104,8 @@ async function saveBuildToDashboard(dashboardPath, build) {
commit: build._commit,
tests: build._tests,
});
if (data.builds.length > DASHBOARD_MAX_BUILDS)
data.builds = data.builds.slice(data.builds.length - DASHBOARD_MAX_BUILDS);
await writeFileAsync(filePath, JSON.stringify(data));
}