Allow a user to manually opt-out of Pages site enablement

This commit is contained in:
James M. Greene
2022-08-02 20:45:01 -05:00
parent 677bce1797
commit 0455a16aca
5 changed files with 15 additions and 5 deletions

View File

@@ -11,6 +11,10 @@ inputs:
description: "GitHub token" description: "GitHub token"
default: ${{ github.token }} default: ${{ github.token }}
required: true required: true
enablement:
description: "Should a Pages site be enabled for the repository if not so already?"
default: "true"
required: false
outputs: outputs:
base_url: base_url:
description: 'GitHub Pages site full base URL. Examples: "https://octocat.github.io/my-repo/", "https://octocat.github.io/", "https://www.example.com/"' description: 'GitHub Pages site full base URL. Examples: "https://octocat.github.io/my-repo/", "https://octocat.github.io/", "https://www.example.com/"'

7
dist/index.js vendored
View File

@@ -14718,7 +14718,8 @@ function getRequiredVars() {
return { return {
repositoryNwo: process.env.GITHUB_REPOSITORY, repositoryNwo: process.env.GITHUB_REPOSITORY,
githubToken: core.getInput('token'), githubToken: core.getInput('token'),
staticSiteGenerator: core.getInput('static_site_generator') staticSiteGenerator: core.getInput('static_site_generator'),
enablement: core.getInput('enablement') !== 'false'
} }
} }
@@ -16384,7 +16385,9 @@ const {getContext} = __nccwpck_require__(1319)
async function main() { async function main() {
try { try {
const context = getContext() const context = getContext()
await enablePages(context) if (context.enablement) {
await enablePages(context)
}
await getPagesBaseUrl(context) await getPagesBaseUrl(context)
} catch (error) { } catch (error) {
core.setFailed(error) core.setFailed(error)

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@@ -5,7 +5,8 @@ function getRequiredVars() {
return { return {
repositoryNwo: process.env.GITHUB_REPOSITORY, repositoryNwo: process.env.GITHUB_REPOSITORY,
githubToken: core.getInput('token'), githubToken: core.getInput('token'),
staticSiteGenerator: core.getInput('static_site_generator') staticSiteGenerator: core.getInput('static_site_generator'),
enablement: core.getInput('enablement') !== 'false'
} }
} }

View File

@@ -9,7 +9,9 @@ const {getContext} = require('./context')
async function main() { async function main() {
try { try {
const context = getContext() const context = getContext()
await enablePages(context) if (context.enablement) {
await enablePages(context)
}
await getPagesBaseUrl(context) await getPagesBaseUrl(context)
} catch (error) { } catch (error) {
core.setFailed(error) core.setFailed(error)