* Mark a pull request as skipped, via the AMP bundle-size GitHub App. * @return {Promise }
()
| 144 | * @return {Promise<void>} |
| 145 | */ |
| 146 | async 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. |
no test coverage detected