mirror of
https://github.com/desktop/desktop
synced 2024-08-24 18:57:33 +00:00
Fetch method for zipped log files (added JSZip library)
This commit is contained in:
parent
46e446fa80
commit
680a45d504
|
@ -14,6 +14,7 @@ import { uuid } from './uuid'
|
|||
import username from 'username'
|
||||
import { GitProtocol } from './remote-parsing'
|
||||
import { Emitter } from 'event-kit'
|
||||
import JSZip from 'jszip'
|
||||
|
||||
const envEndpoint = process.env['DESKTOP_GITHUB_DOTCOM_API_ENDPOINT']
|
||||
const envHTMLURL = process.env['DESKTOP_GITHUB_DOTCOM_HTML_URL']
|
||||
|
@ -1029,7 +1030,7 @@ export class API {
|
|||
/**
|
||||
* List workflow run jobs for a given workflow run
|
||||
*/
|
||||
public async fetchPRWorkflowRunJobs(
|
||||
public async fetchWorkflowRunJobs(
|
||||
workflowRun: IAPIWorkflowRun
|
||||
): Promise<IAPIWorkflowJobs | null> {
|
||||
const customHeaders = {
|
||||
|
@ -1048,6 +1049,31 @@ export class API {
|
|||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* Get JSZip for a workflow run log archive.
|
||||
*
|
||||
* If it fails to retrieve or parse the zip file, it will return null.
|
||||
*/
|
||||
public async fetchWorkflowRunJobLogs(logsUrl: string): Promise<JSZip | null> {
|
||||
const customHeaders = {
|
||||
Accept: 'application/vnd.github.antiope-preview+json',
|
||||
}
|
||||
const response = await this.request('GET', logsUrl, {
|
||||
customHeaders,
|
||||
})
|
||||
|
||||
try {
|
||||
const zipBlob = await response.blob()
|
||||
return new JSZip().loadAsync(zipBlob)
|
||||
} catch (e) {
|
||||
// Sometimes a workflow provides a log url, but still returns a 404
|
||||
// because a log file doesn't makes sense for the workflow. Thus, we just
|
||||
// want to fail without raising an error.
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* Get branch protection info to determine if a user can push to a given branch.
|
||||
*
|
||||
|
|
|
@ -58,8 +58,8 @@
|
|||
"@primer/octicons": "^10.0.0",
|
||||
"@types/plist": "^3.0.2",
|
||||
"@types/react-color": "^3.0.4",
|
||||
"@typescript-eslint/experimental-utils": "^3.5.0",
|
||||
"@typescript-eslint/eslint-plugin": "^3.5.0",
|
||||
"@typescript-eslint/experimental-utils": "^3.5.0",
|
||||
"@typescript-eslint/parser": "^3.5.0",
|
||||
"@typescript-eslint/typescript-estree": "^3.5.0",
|
||||
"airbnb-browser-shims": "^3.0.0",
|
||||
|
@ -93,6 +93,7 @@
|
|||
"jest-diff": "^25.0.0",
|
||||
"jest-extended": "^0.11.2",
|
||||
"jest-localstorage-mock": "^2.3.0",
|
||||
"jszip": "^3.7.1",
|
||||
"klaw-sync": "^3.0.0",
|
||||
"legal-eagle": "0.16.0",
|
||||
"mini-css-extract-plugin": "^0.4.0",
|
||||
|
@ -131,8 +132,8 @@
|
|||
"@types/deep-equal": "^1.0.1",
|
||||
"@types/double-ended-queue": "^2.1.0",
|
||||
"@types/electron-winstaller": "^4.0.0",
|
||||
"@types/estree": "^0.0.49",
|
||||
"@types/eslint": "^7.2.13",
|
||||
"@types/estree": "^0.0.49",
|
||||
"@types/event-kit": "^1.2.28",
|
||||
"@types/express": "^4.11.0",
|
||||
"@types/extract-text-webpack-plugin": "^3.0.3",
|
||||
|
|
31
yarn.lock
31
yarn.lock
|
@ -5832,6 +5832,11 @@ ima-babel6-polyfill@^0.12.0:
|
|||
resolved "https://registry.yarnpkg.com/ima-babel6-polyfill/-/ima-babel6-polyfill-0.12.0.tgz#18aa1e4e898b80eddd89fa696e67c75a14e26228"
|
||||
integrity sha1-GKoeTomLgO3difppbmfHWhTiYig=
|
||||
|
||||
immediate@~3.0.5:
|
||||
version "3.0.6"
|
||||
resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b"
|
||||
integrity sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=
|
||||
|
||||
import-fresh@^3.0.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.0.0.tgz#a3d897f420cab0e671236897f75bc14b4885c390"
|
||||
|
@ -7037,6 +7042,16 @@ jsx-ast-utils@^2.4.1:
|
|||
array-includes "^3.1.1"
|
||||
object.assign "^4.1.0"
|
||||
|
||||
jszip@^3.7.1:
|
||||
version "3.7.1"
|
||||
resolved "https://registry.yarnpkg.com/jszip/-/jszip-3.7.1.tgz#bd63401221c15625a1228c556ca8a68da6fda3d9"
|
||||
integrity sha512-ghL0tz1XG9ZEmRMcEN2vt7xabrDdqHHeykgARpmZ0BiIctWxM47Vt63ZO2dnp4QYt/xJVLLy5Zv1l/xRdh2byg==
|
||||
dependencies:
|
||||
lie "~3.3.0"
|
||||
pako "~1.0.2"
|
||||
readable-stream "~2.3.6"
|
||||
set-immediate-shim "~1.0.1"
|
||||
|
||||
junk@^3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/junk/-/junk-3.1.0.tgz#31499098d902b7e98c5d9b9c80f43457a88abfa1"
|
||||
|
@ -7162,6 +7177,13 @@ levn@~0.3.0:
|
|||
prelude-ls "~1.1.2"
|
||||
type-check "~0.3.2"
|
||||
|
||||
lie@~3.3.0:
|
||||
version "3.3.0"
|
||||
resolved "https://registry.yarnpkg.com/lie/-/lie-3.3.0.tgz#dcf82dee545f46074daf200c7c1c5a08e0f40f6a"
|
||||
integrity sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==
|
||||
dependencies:
|
||||
immediate "~3.0.5"
|
||||
|
||||
lighthouse-logger@^1.0.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/lighthouse-logger/-/lighthouse-logger-1.2.0.tgz#b76d56935e9c137e86a04741f6bb9b2776e886ca"
|
||||
|
@ -8280,7 +8302,7 @@ package-json@^6.3.0:
|
|||
registry-url "^5.0.0"
|
||||
semver "^6.2.0"
|
||||
|
||||
pako@~1.0.5:
|
||||
pako@~1.0.2, pako@~1.0.5:
|
||||
version "1.0.11"
|
||||
resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf"
|
||||
integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==
|
||||
|
@ -9066,7 +9088,7 @@ read-pkg@^5.2.0:
|
|||
parse-json "^5.0.0"
|
||||
type-fest "^0.6.0"
|
||||
|
||||
"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.6:
|
||||
"readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.4, readable-stream@^2.0.5, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.6, readable-stream@~2.3.6:
|
||||
version "2.3.7"
|
||||
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57"
|
||||
integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==
|
||||
|
@ -9719,6 +9741,11 @@ set-getter@^0.1.0:
|
|||
dependencies:
|
||||
to-object-path "^0.3.0"
|
||||
|
||||
set-immediate-shim@~1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61"
|
||||
integrity sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=
|
||||
|
||||
set-value@^0.4.3:
|
||||
version "0.4.3"
|
||||
resolved "https://registry.yarnpkg.com/set-value/-/set-value-0.4.3.tgz#7db08f9d3d22dc7f78e53af3c3bf4666ecdfccf1"
|
||||
|
|
Loading…
Reference in a new issue