Skip to content

Commit 8abc62a

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 8abc62a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ 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+
console.log({CIRCLE_TOKEN});
14+
if (!CIRCLE_TOKEN) {
15+
console.error(
16+
theme.error('Missing required environment variable: CIRCLE_CI_API_TOKEN')
17+
);
18+
process.exit(1);
19+
}
20+
1221
const artifacts = await getArtifactsList(build);
1322
const buildArtifacts = artifacts.find(entry =>
1423
entry.path.endsWith('build.tgz')
@@ -24,7 +33,7 @@ const run = async ({build, cwd, releaseChannel}) => {
2433
// Download and extract artifact
2534
await exec(`rm -rf ./build`, {cwd});
2635
await exec(
27-
`curl -L $(fwdproxy-config curl) ${buildArtifacts.url} | tar -xvz`,
36+
`curl -L $(fwdproxy-config curl) ${buildArtifacts.url} -H "Circle-Token: ${CIRCLE_TOKEN}" | tar -xvz`,
2837
{
2938
cwd,
3039
}

0 commit comments

Comments
 (0)