mirror of
https://github.com/actions/deploy-pages.git
synced 2026-03-30 01:54:52 +00:00
Compare commits
20 Commits
error-coun
...
v2.0.4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9dbe382482 | ||
|
|
96a5bb957b | ||
|
|
8458d4c873 | ||
|
|
0fd60c869b | ||
|
|
9f42854283 | ||
|
|
935c3f915d | ||
|
|
9c31b72d4a | ||
|
|
2b0ca4a2d6 | ||
|
|
f7b0e1891f | ||
|
|
8b4e85a223 | ||
|
|
cca68c9d4b | ||
|
|
73a7feb190 | ||
|
|
2457a7fc63 | ||
|
|
a562022ed9 | ||
|
|
b865ababeb | ||
|
|
12ab2b16cf | ||
|
|
157c090d5a | ||
|
|
39bfa7a819 | ||
|
|
cdd88557f6 | ||
|
|
9cf15d70b7 |
2
.github/workflows/draft-release.yml
vendored
2
.github/workflows/draft-release.yml
vendored
@@ -11,6 +11,6 @@ jobs:
|
|||||||
draft-release:
|
draft-release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: release-drafter/release-drafter@569eb7ee3a85817ab916c8f8ff03a5bd96c9c83e # v5.23.0
|
- uses: release-drafter/release-drafter@65c5fb495d1e69aa8c08a3317bc44ff8aabe9772 # v5.24.0
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -93,12 +93,11 @@ This action is primarily design for use with GitHub.com's Actions workflows and
|
|||||||
|
|
||||||
| Release | GHES Compatibility |
|
| Release | GHES Compatibility |
|
||||||
|:---|:---|
|
|:---|:---|
|
||||||
| [`v2`](https://github.com/actions/deploy-pages/releases/tag/v2) | 🛑 Incompatible. Anticipating compatibility with `>= 3.9`. |
|
| [`v2`](https://github.com/actions/deploy-pages/releases/tag/v2) | `>= 3.9` |
|
||||||
| [`v2.0.1`](https://github.com/actions/deploy-pages/releases/tag/v2.0.1) | 🛑 Incompatible. Anticipating compatibility with `>= 3.9`. |
|
| `v2.x.x` | `>= 3.9` |
|
||||||
| [`v2.0.0`](https://github.com/actions/deploy-pages/releases/tag/v2.0.0) | 🛑 Incompatible. Anticipating compatibility with `>= 3.9`. |
|
|
||||||
| [`v1`](https://github.com/actions/deploy-pages/releases/tag/v1) | `>= 3.7` |
|
| [`v1`](https://github.com/actions/deploy-pages/releases/tag/v1) | `>= 3.7` |
|
||||||
| [`v1.2.8`](https://github.com/actions/deploy-pages/releases/tag/v1.2.8) | `>= 3.7` |
|
| [`v1.2.8`](https://github.com/actions/deploy-pages/releases/tag/v1.2.8) | `>= 3.7` |
|
||||||
| [`v1.2.7`](https://github.com/actions/deploy-pages/releases/tag/v1.2.7) | :warning: [Incompatible](https://github.com/actions/deploy-pages/issues/137). Anticipating compatibility with `>= 3.9`. |
|
| [`v1.2.7`](https://github.com/actions/deploy-pages/releases/tag/v1.2.7) | :warning: `>= 3.9` [Incompatible with prior versions!](https://github.com/actions/deploy-pages/issues/137) |
|
||||||
| [`v1.2.6`](https://github.com/actions/deploy-pages/releases/tag/v1.2.6) | `>= 3.7` |
|
| [`v1.2.6`](https://github.com/actions/deploy-pages/releases/tag/v1.2.6) | `>= 3.7` |
|
||||||
| `v1.x.x` | `>= 3.7` |
|
| `v1.x.x` | `>= 3.7` |
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="116" height="20" role="img" aria-label="Coverage: 80.18%"><title>Coverage: 80.18%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="116" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="63" height="20" fill="#555"/><rect x="63" width="53" height="20" fill="#dfb317"/><rect width="116" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="325" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="530">Coverage</text><text x="325" y="140" transform="scale(.1)" fill="#fff" textLength="530">Coverage</text><text aria-hidden="true" x="885" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">80.18%</text><text x="885" y="140" transform="scale(.1)" fill="#fff" textLength="430">80.18%</text></g></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="116" height="20" role="img" aria-label="Coverage: 79.53%"><title>Coverage: 79.53%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="116" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="63" height="20" fill="#555"/><rect x="63" width="53" height="20" fill="#e05d44"/><rect width="116" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="325" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="530">Coverage</text><text x="325" y="140" transform="scale(.1)" fill="#fff" textLength="530">Coverage</text><text aria-hidden="true" x="885" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">79.53%</text><text x="885" y="140" transform="scale(.1)" fill="#fff" textLength="430">79.53%</text></g></svg>
|
||||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
39
dist/index.js
generated
vendored
39
dist/index.js
generated
vendored
@@ -10052,6 +10052,7 @@ const temporaryErrorStatus = {
|
|||||||
|
|
||||||
const finalErrorStatus = {
|
const finalErrorStatus = {
|
||||||
deployment_failed: 'Deployment failed, try again later.',
|
deployment_failed: 'Deployment failed, try again later.',
|
||||||
|
deployment_perms_error: 'Deployment failed, Please ensure that the file permissions are correct.',
|
||||||
deployment_content_failed:
|
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.',
|
'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_cancelled: 'Deployment cancelled.',
|
||||||
@@ -10080,32 +10081,21 @@ class Deployment {
|
|||||||
this.isPreview = context.isPreview === true
|
this.isPreview = context.isPreview === true
|
||||||
this.timeout = MAX_TIMEOUT
|
this.timeout = MAX_TIMEOUT
|
||||||
this.startTime = null
|
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 || maxErrorCountInput <= 0) {
|
|
||||||
core.warning('Invalid error_count value will be ignored. Please ensure the value is a positive integer.')
|
|
||||||
} else {
|
|
||||||
this.maxErrorCount = maxErrorCountInput
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ask the runtime for the unsigned artifact URL and deploy to GitHub Pages
|
// Ask the runtime for the unsigned artifact URL and deploy to GitHub Pages
|
||||||
// by creating a deployment with that artifact
|
// by creating a deployment with that artifact
|
||||||
async create(idToken) {
|
async create(idToken) {
|
||||||
try {
|
if (Number(core.getInput('timeout')) > MAX_TIMEOUT) {
|
||||||
this.setOptionalUserInput()
|
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)
|
||||||
|
|
||||||
|
try {
|
||||||
core.debug(`Actor: ${this.buildActor}`)
|
core.debug(`Actor: ${this.buildActor}`)
|
||||||
core.debug(`Action ID: ${this.actionsId}`)
|
core.debug(`Action ID: ${this.actionsId}`)
|
||||||
core.debug(`Actions Workflow Run ID: ${this.workflowRun}`)
|
core.debug(`Actions Workflow Run ID: ${this.workflowRun}`)
|
||||||
@@ -10147,9 +10137,6 @@ class Deployment {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.error(error.stack)
|
core.error(error.stack)
|
||||||
|
|
||||||
// output raw error in debug mode.
|
|
||||||
core.debug(JSON.stringify(error))
|
|
||||||
|
|
||||||
// build customized error message based on server response
|
// build customized error message based on server response
|
||||||
if (error.response) {
|
if (error.response) {
|
||||||
let errorMessage = `Failed to create deployment (status: ${error.status}) with build version ${this.buildVersion}. `
|
let errorMessage = `Failed to create deployment (status: ${error.status}) with build version ${this.buildVersion}. `
|
||||||
@@ -10191,6 +10178,7 @@ class Deployment {
|
|||||||
|
|
||||||
const deploymentId = this.deploymentInfo.id || this.buildVersion
|
const deploymentId = this.deploymentInfo.id || this.buildVersion
|
||||||
const reportingInterval = Number(core.getInput('reporting_interval'))
|
const reportingInterval = Number(core.getInput('reporting_interval'))
|
||||||
|
const maxErrorCount = Number(core.getInput('error_count'))
|
||||||
|
|
||||||
let errorCount = 0
|
let errorCount = 0
|
||||||
|
|
||||||
@@ -10233,9 +10221,6 @@ class Deployment {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.error(error.stack)
|
core.error(error.stack)
|
||||||
|
|
||||||
// output raw error in debug mode.
|
|
||||||
core.debug(JSON.stringify(error))
|
|
||||||
|
|
||||||
// build customized error message based on server response
|
// build customized error message based on server response
|
||||||
if (error.response) {
|
if (error.response) {
|
||||||
errorStatus = error.status || error.response.status
|
errorStatus = error.status || error.response.status
|
||||||
@@ -10249,7 +10234,7 @@ class Deployment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errorCount >= this.maxErrorCount) {
|
if (errorCount >= maxErrorCount) {
|
||||||
core.error('Too many errors, aborting!')
|
core.error('Too many errors, aborting!')
|
||||||
core.setFailed('Failed with status code: ' + errorStatus)
|
core.setFailed('Failed with status code: ' + errorStatus)
|
||||||
|
|
||||||
|
|||||||
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
2145
package-lock.json
generated
2145
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -7,17 +7,17 @@
|
|||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/github": "^5.1.1",
|
"@actions/github": "^5.1.1",
|
||||||
"@actions/http-client": "^2.1.0",
|
"@actions/http-client": "^2.1.0",
|
||||||
"@octokit/request-error": "^4.0.1",
|
"@octokit/request-error": "^5.0.0",
|
||||||
"http-status-messages": "^1.1.0"
|
"http-status-messages": "^1.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vercel/ncc": "^0.36.1",
|
"@vercel/ncc": "^0.36.1",
|
||||||
"eslint": "^8.42.0",
|
"eslint": "^8.44.0",
|
||||||
"eslint-config-prettier": "^8.8.0",
|
"eslint-config-prettier": "^8.8.0",
|
||||||
"eslint-plugin-github": "^4.8.0",
|
"eslint-plugin-github": "^4.8.0",
|
||||||
"jest": "^29.5.0",
|
"jest": "^29.6.1",
|
||||||
"nock": "^13.3.1",
|
"nock": "^13.3.1",
|
||||||
"prettier": "^2.8.8",
|
"prettier": "^3.0.0",
|
||||||
"make-coverage-badge": "^1.2.0"
|
"make-coverage-badge": "^1.2.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -44,101 +44,6 @@ describe('Deployment', () => {
|
|||||||
jest.spyOn(core, 'debug').mockImplementation(jest.fn())
|
jest.spyOn(core, 'debug').mockImplementation(jest.fn())
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('#setOptionalUserInput', () => {
|
|
||||||
it('warns when the timeout is greater than the maximum allowed', async () => {
|
|
||||||
jest.spyOn(core, 'getInput').mockImplementation(param => {
|
|
||||||
switch (param) {
|
|
||||||
case 'timeout':
|
|
||||||
return MAX_TIMEOUT + 1
|
|
||||||
default:
|
|
||||||
return process.env[`INPUT_${param.toUpperCase()}`] || ''
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const deployment = new Deployment()
|
|
||||||
deployment.setOptionalUserInput()
|
|
||||||
|
|
||||||
expect(deployment.timeout).toBe(MAX_TIMEOUT)
|
|
||||||
expect(core.warning).toBeCalledWith(
|
|
||||||
`Warning: timeout value is greater than the allowed maximum - timeout set to the maximum of ${MAX_TIMEOUT} milliseconds.`
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('sets the error_count input when valid', async () => {
|
|
||||||
jest.spyOn(core, 'getInput').mockImplementation(param => {
|
|
||||||
switch (param) {
|
|
||||||
case 'error_count':
|
|
||||||
return '1'
|
|
||||||
default:
|
|
||||||
return process.env[`INPUT_${param.toUpperCase()}`] || ''
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// Create the deployment
|
|
||||||
const deployment = new Deployment()
|
|
||||||
deployment.setOptionalUserInput()
|
|
||||||
|
|
||||||
expect(deployment.maxErrorCount).toBe(1)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('sets the error_count input to null if zero and warns user', async () => {
|
|
||||||
jest.spyOn(core, 'getInput').mockImplementation(param => {
|
|
||||||
switch (param) {
|
|
||||||
case 'error_count':
|
|
||||||
return '0'
|
|
||||||
default:
|
|
||||||
return process.env[`INPUT_${param.toUpperCase()}`] || ''
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const deployment = new Deployment()
|
|
||||||
deployment.setOptionalUserInput()
|
|
||||||
|
|
||||||
expect(deployment.maxErrorCount).toBe(null)
|
|
||||||
expect(core.warning).toHaveBeenCalledWith(
|
|
||||||
'Invalid error_count value will be ignored. Please ensure the value is a positive integer.'
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('sets the error_count input to null if negative and warns user', async () => {
|
|
||||||
jest.spyOn(core, 'getInput').mockImplementation(param => {
|
|
||||||
switch (param) {
|
|
||||||
case 'error_count':
|
|
||||||
return '-1'
|
|
||||||
default:
|
|
||||||
return process.env[`INPUT_${param.toUpperCase()}`] || ''
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const deployment = new Deployment()
|
|
||||||
deployment.setOptionalUserInput()
|
|
||||||
|
|
||||||
expect(deployment.maxErrorCount).toBe(null)
|
|
||||||
expect(core.warning).toHaveBeenCalledWith(
|
|
||||||
'Invalid error_count value will be ignored. Please ensure the value is a positive integer.'
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('sets the error_count input to null if not a number and warns user', async () => {
|
|
||||||
jest.spyOn(core, 'getInput').mockImplementation(param => {
|
|
||||||
switch (param) {
|
|
||||||
case 'error_count':
|
|
||||||
return 'not a number'
|
|
||||||
default:
|
|
||||||
return process.env[`INPUT_${param.toUpperCase()}`] || ''
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const deployment = new Deployment()
|
|
||||||
deployment.setOptionalUserInput()
|
|
||||||
|
|
||||||
expect(deployment.maxErrorCount).toBe(null)
|
|
||||||
expect(core.warning).toHaveBeenCalledWith(
|
|
||||||
'Invalid error_count value will be ignored. Please ensure the value is a positive integer.'
|
|
||||||
)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('#create', () => {
|
describe('#create', () => {
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
// Remove mock for `core.getInput('preview')`
|
// Remove mock for `core.getInput('preview')`
|
||||||
@@ -183,42 +88,6 @@ describe('Deployment', () => {
|
|||||||
createDeploymentScope.done()
|
createDeploymentScope.done()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('invokes #setOptionalUserInput', async () => {
|
|
||||||
process.env.GITHUB_SHA = 'valid-build-version'
|
|
||||||
|
|
||||||
const artifactExchangeScope = nock(`http://my-url`)
|
|
||||||
.get('/_apis/pipelines/workflows/123/artifacts?api-version=6.0-preview')
|
|
||||||
.reply(200, {
|
|
||||||
value: [
|
|
||||||
{ url: 'https://another-artifact.com', name: 'another-artifact' },
|
|
||||||
{ url: 'https://fake-artifact.com', name: 'github-pages' }
|
|
||||||
]
|
|
||||||
})
|
|
||||||
|
|
||||||
const createDeploymentScope = nock('https://api.github.com')
|
|
||||||
.post(`/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments`, {
|
|
||||||
artifact_url: 'https://fake-artifact.com&%24expand=SignedContent',
|
|
||||||
pages_build_version: process.env.GITHUB_SHA,
|
|
||||||
oidc_token: fakeJwt
|
|
||||||
})
|
|
||||||
.reply(200, {
|
|
||||||
status_url: `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages/deployments/${process.env.GITHUB_SHA}`,
|
|
||||||
page_url: 'https://actions.github.io/is-awesome'
|
|
||||||
})
|
|
||||||
|
|
||||||
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
|
|
||||||
|
|
||||||
// Create the deployment
|
|
||||||
const deployment = new Deployment()
|
|
||||||
deployment.setOptionalUserInput = jest.fn()
|
|
||||||
await deployment.create(fakeJwt)
|
|
||||||
|
|
||||||
expect(deployment.setOptionalUserInput).toHaveBeenCalled()
|
|
||||||
|
|
||||||
artifactExchangeScope.done()
|
|
||||||
createDeploymentScope.done()
|
|
||||||
})
|
|
||||||
|
|
||||||
it('can successfully create a preview deployment', async () => {
|
it('can successfully create a preview deployment', async () => {
|
||||||
process.env.GITHUB_SHA = 'valid-build-version'
|
process.env.GITHUB_SHA = 'valid-build-version'
|
||||||
|
|
||||||
@@ -718,6 +587,7 @@ describe('Deployment', () => {
|
|||||||
|
|
||||||
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
|
core.getIDToken = jest.fn().mockResolvedValue(fakeJwt)
|
||||||
|
|
||||||
|
// Set timeout to great than max
|
||||||
jest.spyOn(core, 'getInput').mockImplementation(param => {
|
jest.spyOn(core, 'getInput').mockImplementation(param => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
case 'artifact_name':
|
case 'artifact_name':
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ const temporaryErrorStatus = {
|
|||||||
|
|
||||||
const finalErrorStatus = {
|
const finalErrorStatus = {
|
||||||
deployment_failed: 'Deployment failed, try again later.',
|
deployment_failed: 'Deployment failed, try again later.',
|
||||||
|
deployment_perms_error: 'Deployment failed, Please ensure that the file permissions are correct.',
|
||||||
deployment_content_failed:
|
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.',
|
'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_cancelled: 'Deployment cancelled.',
|
||||||
@@ -45,32 +46,21 @@ class Deployment {
|
|||||||
this.isPreview = context.isPreview === true
|
this.isPreview = context.isPreview === true
|
||||||
this.timeout = MAX_TIMEOUT
|
this.timeout = MAX_TIMEOUT
|
||||||
this.startTime = null
|
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 || maxErrorCountInput <= 0) {
|
|
||||||
core.warning('Invalid error_count value will be ignored. Please ensure the value is a positive integer.')
|
|
||||||
} else {
|
|
||||||
this.maxErrorCount = maxErrorCountInput
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ask the runtime for the unsigned artifact URL and deploy to GitHub Pages
|
// Ask the runtime for the unsigned artifact URL and deploy to GitHub Pages
|
||||||
// by creating a deployment with that artifact
|
// by creating a deployment with that artifact
|
||||||
async create(idToken) {
|
async create(idToken) {
|
||||||
try {
|
if (Number(core.getInput('timeout')) > MAX_TIMEOUT) {
|
||||||
this.setOptionalUserInput()
|
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)
|
||||||
|
|
||||||
|
try {
|
||||||
core.debug(`Actor: ${this.buildActor}`)
|
core.debug(`Actor: ${this.buildActor}`)
|
||||||
core.debug(`Action ID: ${this.actionsId}`)
|
core.debug(`Action ID: ${this.actionsId}`)
|
||||||
core.debug(`Actions Workflow Run ID: ${this.workflowRun}`)
|
core.debug(`Actions Workflow Run ID: ${this.workflowRun}`)
|
||||||
@@ -112,9 +102,6 @@ class Deployment {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.error(error.stack)
|
core.error(error.stack)
|
||||||
|
|
||||||
// output raw error in debug mode.
|
|
||||||
core.debug(JSON.stringify(error))
|
|
||||||
|
|
||||||
// build customized error message based on server response
|
// build customized error message based on server response
|
||||||
if (error.response) {
|
if (error.response) {
|
||||||
let errorMessage = `Failed to create deployment (status: ${error.status}) with build version ${this.buildVersion}. `
|
let errorMessage = `Failed to create deployment (status: ${error.status}) with build version ${this.buildVersion}. `
|
||||||
@@ -156,6 +143,7 @@ class Deployment {
|
|||||||
|
|
||||||
const deploymentId = this.deploymentInfo.id || this.buildVersion
|
const deploymentId = this.deploymentInfo.id || this.buildVersion
|
||||||
const reportingInterval = Number(core.getInput('reporting_interval'))
|
const reportingInterval = Number(core.getInput('reporting_interval'))
|
||||||
|
const maxErrorCount = Number(core.getInput('error_count'))
|
||||||
|
|
||||||
let errorCount = 0
|
let errorCount = 0
|
||||||
|
|
||||||
@@ -198,9 +186,6 @@ class Deployment {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.error(error.stack)
|
core.error(error.stack)
|
||||||
|
|
||||||
// output raw error in debug mode.
|
|
||||||
core.debug(JSON.stringify(error))
|
|
||||||
|
|
||||||
// build customized error message based on server response
|
// build customized error message based on server response
|
||||||
if (error.response) {
|
if (error.response) {
|
||||||
errorStatus = error.status || error.response.status
|
errorStatus = error.status || error.response.status
|
||||||
@@ -214,7 +199,7 @@ class Deployment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errorCount >= this.maxErrorCount) {
|
if (errorCount >= maxErrorCount) {
|
||||||
core.error('Too many errors, aborting!')
|
core.error('Too many errors, aborting!')
|
||||||
core.setFailed('Failed with status code: ' + errorStatus)
|
core.setFailed('Failed with status code: ' + errorStatus)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user