Some fixes

This commit is contained in:
Greta Parks
2023-05-12 16:28:50 +00:00
parent c02d64fe5c
commit ccca7e9d96
5 changed files with 48 additions and 42 deletions

34
dist/index.js generated vendored
View File

@@ -10023,7 +10023,7 @@ const finalErrorStatus = {
deployment_lost: 'Deployment failed to report final status.'
}
const maxTimeout = 600000
const MAX_TIMEOUT = 600000
class Deployment {
constructor() {
@@ -10041,21 +10041,21 @@ class Deployment {
this.githubServerUrl = context.githubServerUrl
this.artifactName = context.artifactName
this.isPreview = context.isPreview === true
this.timeout = maxTimeout
this.timeout = MAX_TIMEOUT
this.startTime = null
}
// Ask the runtime for the unsigned artifact URL and deploy to GitHub Pages
// by creating a deployment with that artifact
async create(idToken) {
if (Number(core.getInput('timeout')) > maxTimeout) {
if (Number(core.getInput('timeout')) > MAX_TIMEOUT) {
core.warning(
`Warning: timeout value is greater than the allowed maximum - timeout set to the maximum of ${maxTimeout} milliseconds.`
`Warning: timeout value is greater than the allowed maximum - timeout set to the maximum of ${MAX_TIMEOUT} milliseconds.`
)
}
let timeoutInput = Number(core.getInput('timeout'))
this.timeout = timeoutInput <= 0 ? maxTimeout : Math.min(timeoutInput, maxTimeout)
const TIMEOUT_INPUT = Number(core.getInput('timeout'))
this.timeout = !TIMEOUT_INPUT || TIMEOUT_INPUT <= 0 ? MAX_TIMEOUT : Math.min(TIMEOUT_INPUT, MAX_TIMEOUT)
try {
core.debug(`Actor: ${this.buildActor}`)
@@ -10143,16 +10143,6 @@ class Deployment {
/*eslint no-constant-condition: ["error", { "checkLoops": false }]*/
while (true) {
// Handle timeout
if (Date.now() - this.startTime >= this.timeout) {
core.error('Timeout reached, aborting!')
core.setFailed('Timeout reached, aborting!')
// Explicitly cancel the deployment
await this.cancel()
return
}
// Handle reporting interval
await new Promise(resolve => setTimeout(resolve, reportingInterval + errorReportingInterval))
@@ -10209,6 +10199,16 @@ class Deployment {
await this.cancel()
return
}
// Handle timeout
if (Date.now() - this.startTime >= this.timeout) {
core.error('Timeout reached, aborting!')
core.setFailed('Timeout reached, aborting!')
// Explicitly cancel the deployment
await this.cancel()
return
}
}
}
@@ -10238,7 +10238,7 @@ class Deployment {
}
}
module.exports = { Deployment, maxTimeout }
module.exports = { Deployment, MAX_TIMEOUT }
/***/ }),

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long