From f577a41201f7a2ee5d21c41cb106b22ac3ed5617 Mon Sep 17 00:00:00 2001 From: "James M. Greene" Date: Wed, 22 Feb 2023 08:23:03 -0600 Subject: [PATCH] Swap out the Pages Deployment canceling interaction for the wrapped one from api-client --- src/deployment.js | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/deployment.js b/src/deployment.js index 19cc939..7fd425d 100644 --- a/src/deployment.js +++ b/src/deployment.js @@ -192,19 +192,13 @@ class Deployment { // Cancel the deployment try { - const pagesCancelDeployEndpoint = `${this.githubApiUrl}/repos/${this.repositoryNwo}/pages/deployment/cancel/${this.buildVersion}` - await axios.put( - pagesCancelDeployEndpoint, - {}, - { - headers: { - Accept: 'application/vnd.github.v3+json', - Authorization: `Bearer ${this.githubToken}`, - 'Content-type': 'application/json' - } - } - ) - core.info(`Deployment cancelled with ${pagesCancelDeployEndpoint}`) + const deploymentId = this.deploymentInfo?.id || this.buildVersion + await cancelPagesDeployment({ + githubToken: this.githubToken, + deploymentId + }) + core.info(`Canceled deployment with ID ${deploymentId}`) + if (this.deploymentInfo) { this.deploymentInfo.pending = false }