diff --git a/lib/index.ts b/lib/index.ts index 7acf5ea..4f8c27b 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -102,7 +102,14 @@ class PWMetrics { this.displayOutput(results.median); } else if (this.flags.submit) { const sheets = new Sheets(this.sheets, this.clientSecret); - await sheets.appendResults(results.runs); + + if (this.sheets.options.uploadMedian) { + results.median = this.findMedianRun(results.runs); + await sheets.appendResults([results.median]); + } + else { + await sheets.appendResults(results.runs); + } } await this.outputData(results); diff --git a/readme.md b/readme.md index 039a56a..a0f8f8c 100644 --- a/readme.md +++ b/readme.md @@ -154,7 +154,8 @@ module.exports = { type: 'GOOGLE_SHEETS', // sheets service type. Available types: GOOGLE_SHEETS options: { spreadsheetId: 'sheet_id', - tableName: 'data' + tableName: 'data', + uploadMedian: false // not required, set to true if you want to upload only the median run } }, clientSecret: { diff --git a/types/types.ts b/types/types.ts index 9a84ac9..1953e9e 100644 --- a/types/types.ts +++ b/types/types.ts @@ -7,6 +7,7 @@ export interface SheetsConfig { spreadsheetId: string; tableName: string; clientSecret: AuthorizeCredentials; + uploadMedian?: boolean; }; }