Merge pull request #79 from actions/add-settings-url-to-error

Add repo settings URL to help users react to error message
This commit is contained in:
James M. Greene
2022-11-21 09:51:21 -06:00
committed by GitHub
4 changed files with 9 additions and 3 deletions

5
dist/index.js vendored
View File

@@ -6909,6 +6909,7 @@ function getRequiredVars() {
actionsId: process.env.GITHUB_ACTION,
githubToken: core.getInput('token'),
githubApiUrl: process.env.GITHUB_API_URL ?? 'https://api.github.com',
githubServerUrl: process.env.GITHUB_SERVER_URL ?? 'https://github.com',
artifactName: core.getInput('artifact_name') || 'github-pages',
isPreview: core.getInput('preview') === 'true'
}
@@ -6957,6 +6958,7 @@ class Deployment {
this.requestedDeployment = false
this.deploymentInfo = null
this.githubApiUrl = context.githubApiUrl
this.githubServerUrl = context.githubServerUrl
this.artifactName = context.artifactName
this.isPreview = context.isPreview === true
}
@@ -7027,7 +7029,8 @@ class Deployment {
} else if (error.response.status == 403) {
errorMessage += `Ensure GITHUB_TOKEN has permission "pages: write".`
} else if (error.response.status == 404) {
errorMessage += `Ensure GitHub Pages has been enabled.`
const pagesSettingsUrl = `${this.githubServerUrl}/${this.repositoryNwo}/settings/pages`
errorMessage += `Ensure GitHub Pages has been enabled: ${pagesSettingsUrl}`
} else if (error.response.status >= 500) {
errorMessage += `Server error, is githubstatus.com reporting a Pages outage? Please re-run the deployment at a later time.`
}

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@@ -12,6 +12,7 @@ function getRequiredVars() {
actionsId: process.env.GITHUB_ACTION,
githubToken: core.getInput('token'),
githubApiUrl: process.env.GITHUB_API_URL ?? 'https://api.github.com',
githubServerUrl: process.env.GITHUB_SERVER_URL ?? 'https://github.com',
artifactName: core.getInput('artifact_name') || 'github-pages',
isPreview: core.getInput('preview') === 'true'
}

View File

@@ -24,6 +24,7 @@ class Deployment {
this.requestedDeployment = false
this.deploymentInfo = null
this.githubApiUrl = context.githubApiUrl
this.githubServerUrl = context.githubServerUrl
this.artifactName = context.artifactName
this.isPreview = context.isPreview === true
}
@@ -94,7 +95,8 @@ class Deployment {
} else if (error.response.status == 403) {
errorMessage += `Ensure GITHUB_TOKEN has permission "pages: write".`
} else if (error.response.status == 404) {
errorMessage += `Ensure GitHub Pages has been enabled.`
const pagesSettingsUrl = `${this.githubServerUrl}/${this.repositoryNwo}/settings/pages`
errorMessage += `Ensure GitHub Pages has been enabled: ${pagesSettingsUrl}`
} else if (error.response.status >= 500) {
errorMessage += `Server error, is githubstatus.com reporting a Pages outage? Please re-run the deployment at a later time.`
}