mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 06:17:10 +01:00
Use got to fetch artifact URL
See issue: https://github.com/octokit/request.js/issues/240
This commit is contained in:
parent
1f5bb98685
commit
52024f70c3
3 changed files with 25 additions and 7 deletions
14
dist/index.js
generated
vendored
14
dist/index.js
generated
vendored
|
|
@ -1373,13 +1373,21 @@ async function downloadArtifact(octokit, artifactId, fileName) {
|
||||||
core.startGroup(`Downloading artifact ${fileName}`);
|
core.startGroup(`Downloading artifact ${fileName}`);
|
||||||
try {
|
try {
|
||||||
core.info(`Artifact ID: ${artifactId}`);
|
core.info(`Artifact ID: ${artifactId}`);
|
||||||
const resp = await octokit.actions.downloadArtifact({
|
const req = octokit.actions.downloadArtifact.endpoint({
|
||||||
...github.context.repo,
|
...github.context.repo,
|
||||||
artifact_id: artifactId,
|
artifact_id: artifactId,
|
||||||
archive_format: 'zip'
|
archive_format: 'zip'
|
||||||
});
|
});
|
||||||
core.info(`Fetch artifact URL: ${resp.status}`);
|
const resp = await got_1.default({
|
||||||
const url = resp.headers.Location;
|
url: req.url,
|
||||||
|
headers: req.headers,
|
||||||
|
followRedirect: false
|
||||||
|
});
|
||||||
|
core.info(`Fetch artifact URL: ${resp.statusCode} ${resp.statusMessage}`);
|
||||||
|
if (resp.statusCode !== 302) {
|
||||||
|
throw new Error('Fetch artifact URL failed: received unexpected status code');
|
||||||
|
}
|
||||||
|
const url = resp.headers.location;
|
||||||
if (url === undefined) {
|
if (url === undefined) {
|
||||||
const headers = Object.keys(resp.headers);
|
const headers = Object.keys(resp.headers);
|
||||||
core.info(`Received headers: ${headers.join(', ')}`);
|
core.info(`Received headers: ${headers.join(', ')}`);
|
||||||
|
|
|
||||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
|
|
@ -38,14 +38,24 @@ export async function downloadArtifact(
|
||||||
try {
|
try {
|
||||||
core.info(`Artifact ID: ${artifactId}`)
|
core.info(`Artifact ID: ${artifactId}`)
|
||||||
|
|
||||||
const resp = await octokit.actions.downloadArtifact({
|
const req = octokit.actions.downloadArtifact.endpoint({
|
||||||
...github.context.repo,
|
...github.context.repo,
|
||||||
artifact_id: artifactId,
|
artifact_id: artifactId,
|
||||||
archive_format: 'zip'
|
archive_format: 'zip'
|
||||||
})
|
})
|
||||||
|
|
||||||
core.info(`Fetch artifact URL: ${resp.status}`)
|
const resp = await got({
|
||||||
const url = resp.headers.Location
|
url: req.url,
|
||||||
|
headers: req.headers as {[header: string]: string},
|
||||||
|
followRedirect: false
|
||||||
|
})
|
||||||
|
|
||||||
|
core.info(`Fetch artifact URL: ${resp.statusCode} ${resp.statusMessage}`)
|
||||||
|
if (resp.statusCode !== 302) {
|
||||||
|
throw new Error('Fetch artifact URL failed: received unexpected status code')
|
||||||
|
}
|
||||||
|
|
||||||
|
const url = resp.headers.location
|
||||||
if (url === undefined) {
|
if (url === undefined) {
|
||||||
const headers = Object.keys(resp.headers)
|
const headers = Object.keys(resp.headers)
|
||||||
core.info(`Received headers: ${headers.join(', ')}`)
|
core.info(`Received headers: ${headers.join(', ')}`)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue