Skip to content

Commit a013cc9

Browse files
committed
Add authorization header to artifacts request
CircleCI's artifacts API was updated; it now errors unless you're logged in. This affects any of our workflows that download build artifacts. To fix, I added an authorization header to the request.
1 parent 0412f0c commit a013cc9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ const {getArtifactsList, logPromise} = require('../utils');
99
const theme = require('../theme');
1010

1111
const run = async ({build, cwd, releaseChannel}) => {
12+
const CIRCLE_TOKEN = process.env.CIRCLE_CI_API_TOKEN;
13+
if (!CIRCLE_TOKEN) {
14+
console.error(
15+
theme.error('Missing required environment variable: CIRCLE_CI_API_TOKEN')
16+
);
17+
process.exit(1);
18+
}
19+
1220
const artifacts = await getArtifactsList(build);
1321
const buildArtifacts = artifacts.find(entry =>
1422
entry.path.endsWith('build.tgz')
@@ -24,7 +32,7 @@ const run = async ({build, cwd, releaseChannel}) => {
2432
// Download and extract artifact
2533
await exec(`rm -rf ./build`, {cwd});
2634
await exec(
27-
`curl -L $(fwdproxy-config curl) ${buildArtifacts.url} | tar -xvz`,
35+
`curl -L $(fwdproxy-config curl) ${buildArtifacts.url} -H "Circle-Token: ${CIRCLE_TOKEN}" | tar -xvz`,
2836
{
2937
cwd,
3038
}

0 commit comments

Comments
 (0)