MCPcopy
hub / github.com/ampproject/amphtml / skipBundleSize

Function skipBundleSize

build-system/tasks/bundle-size/index.js:146–176  ·  view source on GitHub ↗

* Mark a pull request as skipped, via the AMP bundle-size GitHub App. * @return {Promise }

()

Source from the content-addressed store, hash-verified

144 * @return {Promise<void>}
145 */
146async function skipBundleSize() {
147 if (isPullRequestBuild()) {
148 const commitHash = gitCommitHash();
149 log(
150 'Skipping bundle size reporting for commit',
151 cyan(shortSha(commitHash)) + '...'
152 );
153 try {
154 const response = await fetch(
155 url.resolve(
156 bundleSizeAppBaseUrl,
157 path.join('commit', commitHash, 'skip')
158 ),
159 {method: 'POST'}
160 );
161 await checkResponse(
162 response,
163 'Successfully skipped bundle size reporting.'
164 );
165 } catch (error) {
166 log(yellow('WARNING:'), 'Could not skip bundle size reporting');
167 logWithoutTimestamp(error);
168 return;
169 }
170 } else {
171 log(
172 yellow('WARNING'),
173 'Pull requests can be marked as skipped only during CI builds'
174 );
175 }
176}
177
178/**
179 * Report the size to the bundle-size GitHub App, to determine size changes.

Callers 1

bundleSizeFunction · 0.85

Calls 10

isPullRequestBuildFunction · 0.85
gitCommitHashFunction · 0.85
cyanFunction · 0.85
shortShaFunction · 0.85
fetchFunction · 0.85
checkResponseFunction · 0.85
yellowFunction · 0.85
logWithoutTimestampFunction · 0.85
resolveMethod · 0.80
logFunction · 0.50

Tested by

no test coverage detected