build: payload status should not show all digits (#6051)

* Currently we always limit the difference in kilobytes to two digits after the decimal point. This also needs to be done for the full package size to avoid super long numbers.
This commit is contained in:
Paul Gschwendtner
2017-07-27 18:48:42 +02:00
committed by Andrew Seguin
parent 055f662a85
commit f3b4e7c6b0
@@ -36,11 +36,12 @@ export const payloadGithubStatus = https.onRequest(async (request, response) =>
// Better message about the diff that shows whether the payload increased or decreased.
const diffMessage = packageDiff < 0 ? 'decrease' : 'increase';
const diffFormatted = Math.abs(packageDiff).toFixed(2);
const packageSizeFormatted = packageSize.toFixed(2);
await setGithubStatus(commitSha, {
result: true,
name: `${capitalizeFirstLetter(packageName)} Payload Size`,
description: `${packageSize}kb / ${diffFormatted}kb ${diffMessage} (ES2015 bundle)`
description: `${packageSizeFormatted}kb / ${diffFormatted}kb ${diffMessage} (ES2015 bundle)`
});
response.json({message: 'Payload Github status successfully set.'});