set output page_url

This commit is contained in:
yimysty
2021-12-21 17:37:44 -08:00
parent 46cc072901
commit 4dc1554446
5 changed files with 20 additions and 5 deletions

View File

@@ -18,6 +18,7 @@ class Deployment {
this.githubToken = context.githubToken
this.workflowRun = context.workflowRun
this.requestedDeployment = false
this.deploymentInfo = null
}
// Ask the runtime for the unsigned artifact URL and deploy to GitHub Pages
@@ -56,6 +57,7 @@ class Deployment {
this.requestedDeployment = true
core.info(`Created deployment for ${this.buildVersion}`)
core.info(JSON.stringify(response.data))
this.deploymentInfo = response.data
} catch (error) {
core.info(`Failed to create deployment for ${this.buildVersion}.`)
if (error.response && error.response.data) {
@@ -69,7 +71,10 @@ class Deployment {
// Poll the deployment endpoint for status
async check() {
try {
const statusUrl = `https://api.github.com/repos/${this.repositoryNwo}/pages/deployment/status/${process.env['GITHUB_SHA']}`
const statusUrl = this.deploymentInfo != null ?
this.deploymentInfo["status_url"] :
`https://api.github.com/repos/${this.repositoryNwo}/pages/deployment/status/${process.env['GITHUB_SHA']}`
core.setOutput('page_url', this.deploymentInfo != null ? this.deploymentInfo["page_url"] : "");
const timeout = core.getInput('timeout')
const reportingInterval = core.getInput('reporting_interval')
const maxErrorCount = core.getInput('error_count')