Update sizebot to match name of CircleCI build job (#15714)
The sizebot scrapes the GitHub `/statuses` endpoint to get the lastest CircleCI build number for master, in order to fetch the bundle size info for that build, which are stored as build artifacts. (There's gotta be a better way to do this, but that's what we have for now.) This updates the script to match the name of the updated CircleCI job that generates the bundle sizes.
Andrew Clark committed
May 22, 2019 at 16:12 UTC
d66c8f2d9d0ffec76afe98dea635feabd603b698
2 files changed
+23
-2
.circleci/config.yml
+15
-1
@@ -126,7 +126,6 @@ jobs:
126
- run: ./scripts/circleci/update_package_versions.sh
127
- run: ./scripts/circleci/build.sh
128
- run: cp ./scripts/rollup/results.json ./build/bundle-sizes.json
129
- - run: node ./scripts/tasks/danger
129
- run: ./scripts/circleci/upload_build.sh
130
- run: ./scripts/circleci/pack_and_store_artifact.sh
131
- store_artifacts:
@@ -143,6 +142,18 @@ jobs:
142
- facebook-www
143
- node_modules
144
- react-native
145
+ - bundle-sizes.json
146
+
147
+ sizebot:
148
+ build:
149
+ docker: *docker
150
+ environment: *environment
151
+ steps:
152
+ - checkout
153
+ - attach_workspace: *attach_workspace
154
+ - *restore_yarn_cache
155
+ - *run_yarn
156
+ - run: node ./scripts/tasks/danger
157
158
test_build:
159
docker: *docker
@@ -193,6 +204,9 @@ workflows:
204
- build:
205
requires:
206
- setup
207
+ - sizebot:
208
+ requires:
209
+ - build
210
- test_build:
211
requires:
212
- build
dangerfile.js
+8
-1
@@ -36,6 +36,10 @@ if (!existsSync('./build/bundle-sizes.json')) {
36
// This indicates the build failed previously.
37
// In that case, there's nothing for the Dangerfile to do.
38
// Exit early to avoid leaving a redundant (and potentially confusing) PR comment.
39
+ warn(
40
+ 'No bundle size information found. This indicates the build ' +
41
+ 'job failed.'
42
+ );
43
process.exit(0);
44
}
45
@@ -127,7 +131,8 @@ function git(args) {
131
const statuses = await statusesResponse.json();
132
for (let i = 0; i < statuses.length; i++) {
133
const status = statuses[i];
130
- if (status.context === 'ci/circleci') {
134
+ // This must match the name of the CI job that creates the build artifacts
135
+ if (status.context === 'ci/circleci: build') {
136
if (status.state === 'success') {
137
baseCIBuildId = /\/facebook\/react\/([0-9]+)/.exec(
138
status.target_url
@@ -271,5 +276,7 @@ function git(args) {
276
</details>
277
`;
278
markdown(summary);
279
+ } else {
280
+ markdown('No significant bundle size changes to report.');
281
}
282
})();