mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
Ensure sizebot doesn't swallow large diffs (#28845)
This commit is contained in:
committed by
GitHub
parent
17e920c00d
commit
8f212cc789
@@ -211,6 +211,8 @@ jobs:
|
||||
- setup_node_modules
|
||||
- run:
|
||||
command: node ./scripts/tasks/danger
|
||||
- store_artifacts:
|
||||
path: sizebot-message.md
|
||||
|
||||
build_devtools_and_process_artifacts:
|
||||
docker: *docker
|
||||
|
||||
@@ -31,6 +31,7 @@ const {markdown, danger, warn} = require('danger');
|
||||
const {promisify} = require('util');
|
||||
const glob = promisify(require('glob'));
|
||||
const gzipSize = require('gzip-size');
|
||||
const {writeFileSync} = require('fs');
|
||||
|
||||
const {readFileSync, statSync} = require('fs');
|
||||
|
||||
@@ -236,7 +237,7 @@ function row(result, baseSha, headSha) {
|
||||
}
|
||||
}
|
||||
|
||||
markdown(`
|
||||
const message = `
|
||||
Comparing: ${baseSha}...${headSha}
|
||||
|
||||
## Critical size changes
|
||||
@@ -263,5 +264,17 @@ ${significantResults.join('\n')}
|
||||
`
|
||||
: '(No significant changes)'
|
||||
}
|
||||
`);
|
||||
`;
|
||||
|
||||
// GitHub comments are limited to 65536 characters.
|
||||
if (message.length > 65536) {
|
||||
// Make message available as an artifact
|
||||
writeFileSync('sizebot-message.md', message);
|
||||
markdown(
|
||||
'The size diff is too large to display in a single comment. ' +
|
||||
`The [CircleCI job](${process.env.CIRCLE_BUILD_URL}) contains an artifact called 'sizebot-message.md' with the full message.`
|
||||
);
|
||||
} else {
|
||||
markdown(message);
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user