mirror of
https://github.com/actions/deploy-pages.git
synced 2026-03-30 18:14:52 +00:00
test early exit on a deployment cancel request
This commit is contained in:
@@ -8,6 +8,7 @@ const fakeJwt =
|
|||||||
|
|
||||||
describe('Deployment', () => {
|
describe('Deployment', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
jest.clearAllMocks()
|
||||||
process.env.ACTIONS_RUNTIME_URL = 'http://my-url/'
|
process.env.ACTIONS_RUNTIME_URL = 'http://my-url/'
|
||||||
process.env.GITHUB_RUN_ID = '123'
|
process.env.GITHUB_RUN_ID = '123'
|
||||||
process.env.ACTIONS_RUNTIME_TOKEN = 'a-token'
|
process.env.ACTIONS_RUNTIME_TOKEN = 'a-token'
|
||||||
@@ -395,5 +396,18 @@ describe('Deployment', () => {
|
|||||||
createDeploymentScope.done()
|
createDeploymentScope.done()
|
||||||
cancelDeploymentScope.done()
|
cancelDeploymentScope.done()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('can exit if a pages deployment was not created and none need to be cancelled', async () => {
|
||||||
|
process.env.GITHUB_SHA = 'valid-build-version'
|
||||||
|
|
||||||
|
// Create the deployment
|
||||||
|
const deployment = new Deployment()
|
||||||
|
|
||||||
|
// Cancel it
|
||||||
|
await deployment.cancel()
|
||||||
|
|
||||||
|
expect(core.debug).toHaveBeenCalledWith('all variables are set')
|
||||||
|
expect(core.debug).toHaveBeenCalledWith(`No deployment to cancel`)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="110" height="20" role="img" aria-label="Coverage: 69.3%"><title>Coverage: 69.3%</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="110" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="63" height="20" fill="#555"/><rect x="63" width="47" height="20" fill="#e05d44"/><rect width="110" 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="855" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="370">69.3%</text><text x="855" y="140" transform="scale(.1)" fill="#fff" textLength="370">69.3%</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: 69.95%"><title>Coverage: 69.95%</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">69.95%</text><text x="885" y="140" transform="scale(.1)" fill="#fff" textLength="430">69.95%</text></g></svg>
|
||||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -203,6 +203,7 @@ class Deployment {
|
|||||||
async cancel() {
|
async cancel() {
|
||||||
// Don't attempt to cancel if no deployment was created
|
// Don't attempt to cancel if no deployment was created
|
||||||
if (!this.deploymentInfo || this.deploymentInfo.pending !== true) {
|
if (!this.deploymentInfo || this.deploymentInfo.pending !== true) {
|
||||||
|
core.debug('No deployment to cancel')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user