Swap out the Pages Deployment status check interaction for the wrapped one from api-client

This commit is contained in:
James M. Greene
2023-02-22 08:22:23 -06:00
parent 12b8ec3b9b
commit a0faa043a9

View File

@@ -97,19 +97,18 @@ class Deployment {
// Poll the deployment endpoint for status // Poll the deployment endpoint for status
async check() { async check() {
try { const deploymentId = this.deploymentInfo?.id || this.buildVersion
const statusUrl = const timeout = Number(core.getInput('timeout'))
this.deploymentInfo != null const reportingInterval = Number(core.getInput('reporting_interval'))
? this.deploymentInfo['status_url'] const maxErrorCount = Number(core.getInput('error_count'))
: `${this.githubApiUrl}/repos/${this.repositoryNwo}/pages/deployment/status/${this.buildVersion}`
const timeout = Number(core.getInput('timeout'))
const reportingInterval = Number(core.getInput('reporting_interval'))
const maxErrorCount = Number(core.getInput('error_count'))
var startTime = Date.now()
var errorCount = 0
// Time in milliseconds between two deployment status report when status errored, default 0. let startTime = Date.now()
var errorReportingInterval = 0 let errorCount = 0
// Time in milliseconds between two deployment status report when status errored, default 0.
let errorReportingInterval = 0
try {
/*eslint no-constant-condition: ["error", { "checkLoops": false }]*/ /*eslint no-constant-condition: ["error", { "checkLoops": false }]*/
while (true) { while (true) {
@@ -117,10 +116,9 @@ class Deployment {
await new Promise(r => setTimeout(r, reportingInterval + errorReportingInterval)) await new Promise(r => setTimeout(r, reportingInterval + errorReportingInterval))
// Check status // Check status
var res = await axios.get(statusUrl, { let res = await getPagesDeploymentStatus({
headers: { githubToken: this.githubToken,
Authorization: `token ${this.githubToken}` deploymentId
}
}) })
if (res.data.status == 'succeed') { if (res.data.status == 'succeed') {