Skip to content

Commit 7ef111d

Browse files
committed
[ci] Fix download_base_build_for_sizebot
CircleCI now enforces passing a token when fetching artifacts.
1 parent 6854a3c commit 7ef111d

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

scripts/release/shared-commands/download-build-artifacts.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,15 @@ const run = async ({build, cwd, releaseChannel}) => {
2222
}
2323

2424
// Download and extract artifact
25+
const {CIRCLE_CI_API_TOKEN} = process.env;
26+
if (CIRCLE_CI_API_TOKEN == null) {
27+
throw new Error(
28+
`Expected a CircleCI token to download artifacts, got ${CIRCLE_CI_API_TOKEN}`
29+
);
30+
}
2531
await exec(`rm -rf ./build`, {cwd});
2632
await exec(
27-
`curl -L $(fwdproxy-config curl) ${buildArtifacts.url} | tar -xvz`,
33+
`curl -L $(fwdproxy-config curl) ${buildArtifacts.url} -H "Circle-Token: ${CIRCLE_CI_API_TOKEN}" | tar -xvz`,
2834
{
2935
cwd,
3036
}

scripts/release/utils.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,21 @@ const extractCommitFromVersionNumber = version => {
5959
};
6060

6161
const getArtifactsList = async buildID => {
62+
const {CIRCLE_CI_API_TOKEN} = process.env;
63+
if (CIRCLE_CI_API_TOKEN == null) {
64+
throw new Error(
65+
`Expected a CircleCI token to download artifacts, got ${CIRCLE_CI_API_TOKEN}`
66+
);
67+
}
6268
const jobArtifactsURL = `https://circleci.com/api/v1.1/project/github/facebook/react/${buildID}/artifacts`;
63-
const jobArtifacts = await http.get(jobArtifactsURL, true);
69+
const jobArtifacts = await http({
70+
method: 'GET',
71+
uri: jobArtifactsURL,
72+
headers: {
73+
'Circle-Token': CIRCLE_CI_API_TOKEN,
74+
},
75+
json: true,
76+
});
6477
return jobArtifacts;
6578
};
6679

0 commit comments

Comments
 (0)