diff --git a/__tests__/functions/deployment.test.js b/__tests__/functions/deployment.test.js
index 0680c4d..ceca123 100644
--- a/__tests__/functions/deployment.test.js
+++ b/__tests__/functions/deployment.test.js
@@ -8,6 +8,7 @@ const fakeJwt =
describe('Deployment', () => {
beforeEach(() => {
+ jest.clearAllMocks()
process.env.ACTIONS_RUNTIME_URL = 'http://my-url/'
process.env.GITHUB_RUN_ID = '123'
process.env.ACTIONS_RUNTIME_TOKEN = 'a-token'
@@ -395,5 +396,18 @@ describe('Deployment', () => {
createDeploymentScope.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`)
+ })
})
})
diff --git a/badges/coverage.svg b/badges/coverage.svg
index 92eec06..aa107bc 100644
--- a/badges/coverage.svg
+++ b/badges/coverage.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/functions/deployment.js b/src/functions/deployment.js
index b18ccfa..f5ba539 100644
--- a/src/functions/deployment.js
+++ b/src/functions/deployment.js
@@ -203,6 +203,7 @@ class Deployment {
async cancel() {
// Don't attempt to cancel if no deployment was created
if (!this.deploymentInfo || this.deploymentInfo.pending !== true) {
+ core.debug('No deployment to cancel')
return
}