Add repo settings URL to help users react to error message

This commit is contained in:
James M. Greene
2022-11-17 12:35:08 -06:00
parent af875e2038
commit 3ffff52a9c
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, actionsId: process.env.GITHUB_ACTION,
githubToken: core.getInput('token'), githubToken: core.getInput('token'),
githubApiUrl: process.env.GITHUB_API_URL ?? 'https://api.github.com', 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', artifactName: core.getInput('artifact_name') || 'github-pages',
isPreview: core.getInput('preview') === 'true' isPreview: core.getInput('preview') === 'true'
} }
@@ -6957,6 +6958,7 @@ class Deployment {
this.requestedDeployment = false this.requestedDeployment = false
this.deploymentInfo = null this.deploymentInfo = null
this.githubApiUrl = context.githubApiUrl this.githubApiUrl = context.githubApiUrl
this.githubServerUrl = context.githubServerUrl
this.artifactName = context.artifactName this.artifactName = context.artifactName
this.isPreview = context.isPreview === true this.isPreview = context.isPreview === true
} }
@@ -7027,7 +7029,8 @@ class Deployment {
} else if (error.response.status == 403) { } else if (error.response.status == 403) {
errorMessage += `Ensure GITHUB_TOKEN has permission "pages: write".` errorMessage += `Ensure GITHUB_TOKEN has permission "pages: write".`
} else if (error.response.status == 404) { } 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) { } 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.` 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, actionsId: process.env.GITHUB_ACTION,
githubToken: core.getInput('token'), githubToken: core.getInput('token'),
githubApiUrl: process.env.GITHUB_API_URL ?? 'https://api.github.com', 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', artifactName: core.getInput('artifact_name') || 'github-pages',
isPreview: core.getInput('preview') === 'true' isPreview: core.getInput('preview') === 'true'
} }

View File

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