mirror of
https://github.com/actions/deploy-pages.git
synced 2026-03-30 01:54:52 +00:00
Update distributables
This commit is contained in:
67
dist/index.js
vendored
67
dist/index.js
vendored
@@ -9762,12 +9762,20 @@ const {
|
|||||||
cancelPagesDeployment
|
cancelPagesDeployment
|
||||||
} = __nccwpck_require__(9432)
|
} = __nccwpck_require__(9432)
|
||||||
|
|
||||||
const errorStatus = {
|
const temporaryErrorStatus = {
|
||||||
unknown_status: 'Unable to get deployment status.',
|
unknown_status: 'Unable to get deployment status.',
|
||||||
not_found: 'Deployment not found.',
|
not_found: 'Deployment not found.',
|
||||||
deployment_attempt_error: 'Deployment temporarily failed, a retry will be automatically scheduled...'
|
deployment_attempt_error: 'Deployment temporarily failed, a retry will be automatically scheduled...'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const finalErrorStatus = {
|
||||||
|
deployment_failed: 'Deployment failed, try again later.',
|
||||||
|
deployment_content_failed:
|
||||||
|
'Artifact could not be deployed. Please ensure the content does not contain any hard links, symlinks and total size is less than 10GB.',
|
||||||
|
deployment_cancelled: 'Deployment cancelled.',
|
||||||
|
deployment_lost: 'Deployment failed to report final status.'
|
||||||
|
}
|
||||||
|
|
||||||
class Deployment {
|
class Deployment {
|
||||||
constructor() {
|
constructor() {
|
||||||
const context = getContext()
|
const context = getContext()
|
||||||
@@ -9854,11 +9862,11 @@ class Deployment {
|
|||||||
async check() {
|
async check() {
|
||||||
// Don't attempt to check status if no deployment was created
|
// Don't attempt to check status if no deployment was created
|
||||||
if (!this.deploymentInfo) {
|
if (!this.deploymentInfo) {
|
||||||
core.setFailed(errorStatus.not_found)
|
core.setFailed(temporaryErrorStatus.not_found)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (this.deploymentInfo.pending !== true) {
|
if (this.deploymentInfo.pending !== true) {
|
||||||
core.setFailed(errorStatus.unknown_status)
|
core.setFailed(temporaryErrorStatus.unknown_status)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9872,58 +9880,62 @@ class Deployment {
|
|||||||
|
|
||||||
// Time in milliseconds between two deployment status report when status errored, default 0.
|
// Time in milliseconds between two deployment status report when status errored, default 0.
|
||||||
let errorReportingInterval = 0
|
let errorReportingInterval = 0
|
||||||
|
let deployment = null
|
||||||
|
let errorStatus = 0
|
||||||
|
|
||||||
try {
|
|
||||||
/*eslint no-constant-condition: ["error", { "checkLoops": false }]*/
|
/*eslint no-constant-condition: ["error", { "checkLoops": false }]*/
|
||||||
while (true) {
|
while (true) {
|
||||||
// Handle reporting interval
|
// Handle reporting interval
|
||||||
await new Promise(resolve => setTimeout(resolve, reportingInterval + errorReportingInterval))
|
await new Promise(resolve => setTimeout(resolve, reportingInterval + errorReportingInterval))
|
||||||
|
|
||||||
// Check status
|
// Check status
|
||||||
let res = await getPagesDeploymentStatus({
|
try {
|
||||||
|
deployment = await getPagesDeploymentStatus({
|
||||||
githubToken: this.githubToken,
|
githubToken: this.githubToken,
|
||||||
deploymentId
|
deploymentId
|
||||||
})
|
})
|
||||||
|
|
||||||
if (res.data.status === 'succeed') {
|
if (deployment.status === 'succeed') {
|
||||||
core.info('Reported success!')
|
core.info('Reported success!')
|
||||||
core.setOutput('status', 'succeed')
|
core.setOutput('status', 'succeed')
|
||||||
this.deploymentInfo.pending = false
|
this.deploymentInfo.pending = false
|
||||||
break
|
break
|
||||||
} else if (res.data.status === 'deployment_failed') {
|
} else if (finalErrorStatus[deployment.status]) {
|
||||||
// Fall into permanent error, it may be caused by ongoing incident or malicious deployment content or exhausted automatic retry times.
|
// Fall into permanent error, it may be caused by ongoing incident, malicious deployment content, exhausted automatic retry times, invalid artifact, etc.
|
||||||
core.setFailed('Deployment failed, try again later.')
|
core.setFailed(finalErrorStatus[deployment.status])
|
||||||
this.deploymentInfo.pending = false
|
this.deploymentInfo.pending = false
|
||||||
break
|
break
|
||||||
} else if (res.data.status === 'deployment_content_failed') {
|
} else if (temporaryErrorStatus[deployment.status]) {
|
||||||
// The uploaded artifact is invalid.
|
|
||||||
core.setFailed(
|
|
||||||
'Artifact could not be deployed. Please ensure the content does not contain any hard links, symlinks and total size is less than 10GB.'
|
|
||||||
)
|
|
||||||
this.deploymentInfo.pending = false
|
|
||||||
break
|
|
||||||
} else if (errorStatus[res.data.status]) {
|
|
||||||
// A temporary error happened, will query the status again
|
// A temporary error happened, will query the status again
|
||||||
core.warning(errorStatus[res.data.status])
|
core.warning(temporaryErrorStatus[deployment.status])
|
||||||
} else {
|
} else {
|
||||||
core.info('Current status: ' + res.data.status)
|
core.info('Current status: ' + deployment.status)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res.status !== 200 || !!errorStatus[res.data.status]) {
|
// reset the error reporting interval once get the proper status back.
|
||||||
|
errorReportingInterval = 0
|
||||||
|
} catch (error) {
|
||||||
|
core.error(error.stack)
|
||||||
|
|
||||||
|
// output raw error in debug mode.
|
||||||
|
core.debug(JSON.stringify(error))
|
||||||
|
|
||||||
|
// build customized error message based on server response
|
||||||
|
if (error.response) {
|
||||||
|
errorStatus = error.response.status
|
||||||
|
|
||||||
errorCount++
|
errorCount++
|
||||||
|
|
||||||
// set the maximum error reporting interval greater than 15 sec but below 30 sec.
|
// set the maximum error reporting interval greater than 15 sec but below 30 sec.
|
||||||
if (errorReportingInterval < 1000 * 15) {
|
if (errorReportingInterval < 1000 * 15) {
|
||||||
errorReportingInterval = (errorReportingInterval << 1) | 1
|
errorReportingInterval = (errorReportingInterval << 1) | 1
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
// reset the error reporting interval once get the proper status back.
|
|
||||||
errorReportingInterval = 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errorCount >= maxErrorCount) {
|
if (errorCount >= maxErrorCount) {
|
||||||
core.error('Too many errors, aborting!')
|
core.error('Too many errors, aborting!')
|
||||||
core.setFailed('Failed with status code: ' + res.status)
|
core.setFailed('Failed with status code: ' + errorStatus)
|
||||||
|
|
||||||
// Explicitly cancel the deployment
|
// Explicitly cancel the deployment
|
||||||
await this.cancel()
|
await this.cancel()
|
||||||
@@ -9940,12 +9952,6 @@ class Deployment {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
core.setFailed(error)
|
|
||||||
if (error.response?.data) {
|
|
||||||
core.error(JSON.stringify(error.response.data))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async cancel() {
|
async cancel() {
|
||||||
@@ -9972,6 +9978,7 @@ class Deployment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { Deployment }
|
module.exports = { Deployment }
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user