Merge pull request #8 from actions/expose-page-url

set output page_url
This commit is contained in:
Mingzi
2021-12-22 11:05:54 -08:00
committed by GitHub
6 changed files with 23 additions and 5 deletions

View File

@@ -21,3 +21,6 @@ inputs:
description: 'Time in milliseconds between two deployment status report (default: 1 second)'
required: false
default: "1000"
outputs:
page_url:
description: 'URL to deployed Github Pages'

7
dist/index.js vendored
View File

@@ -7062,6 +7062,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
@@ -7100,6 +7101,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) {
@@ -7113,7 +7115,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')

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@@ -7062,6 +7062,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
@@ -7100,6 +7101,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) {
@@ -7113,7 +7115,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')

File diff suppressed because one or more lines are too long

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')