adds a check for error_count variable

This commit is contained in:
Greta Parks
2023-05-22 22:59:30 +00:00
parent b580d214b4
commit a378718509
5 changed files with 137 additions and 23 deletions

29
dist/index.js generated vendored
View File

@@ -10043,19 +10043,29 @@ class Deployment {
this.isPreview = context.isPreview === true
this.timeout = MAX_TIMEOUT
this.startTime = null
this.maxErrorCount = null
}
setOptionalUserInput() {
const timeoutInput = Number(core.getInput('timeout'))
if (timeoutInput > MAX_TIMEOUT) {
core.warning(
`Warning: timeout value is greater than the allowed maximum - timeout set to the maximum of ${MAX_TIMEOUT} milliseconds.`
)
}
this.timeout = !timeoutInput || timeoutInput <= 0 ? MAX_TIMEOUT : Math.min(timeoutInput, MAX_TIMEOUT)
const maxErrorCountInput = Number(core.getInput('error_count'))
if (maxErrorCountInput <= 0) {
core.warning('Invalid error_count value will be ignored. Please ensure the value is a positive integer.')
}
this.maxErrorCount = !maxErrorCountInput || maxErrorCountInput <= 0 ? null : maxErrorCountInput
}
// 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')) > MAX_TIMEOUT) {
core.warning(
`Warning: timeout value is greater than the allowed maximum - timeout set to the maximum of ${MAX_TIMEOUT} milliseconds.`
)
}
const timeoutInput = Number(core.getInput('timeout'))
this.timeout = !timeoutInput || timeoutInput <= 0 ? MAX_TIMEOUT : Math.min(timeoutInput, MAX_TIMEOUT)
this.setOptionalUserInput()
try {
core.debug(`Actor: ${this.buildActor}`)
@@ -10137,7 +10147,6 @@ class Deployment {
const deploymentId = this.deploymentInfo.id || this.buildVersion
const reportingInterval = Number(core.getInput('reporting_interval'))
const maxErrorCount = Number(core.getInput('error_count'))
let errorCount = 0
@@ -10196,7 +10205,7 @@ class Deployment {
}
}
if (errorCount >= maxErrorCount) {
if (errorCount >= this.maxErrorCount) {
core.error('Too many errors, aborting!')
core.setFailed('Failed with status code: ' + errorStatus)

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long