mirror of
https://github.com/actions/configure-pages.git
synced 2026-02-09 03:45:14 +00:00
Update dist
This commit is contained in:
195
dist/index.js
vendored
195
dist/index.js
vendored
@@ -14423,6 +14423,100 @@ if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) {
|
|||||||
exports.debug = debug; // for test
|
exports.debug = debug; // for test
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 9432:
|
||||||
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
|
const axios = __nccwpck_require__(6545)
|
||||||
|
const core = __nccwpck_require__(2186)
|
||||||
|
|
||||||
|
async function enablePagesSite({ repositoryNwo, githubToken }) {
|
||||||
|
const pagesEndpoint = `https://api.github.com/repos/${repositoryNwo}/pages`
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await axios.post(
|
||||||
|
pagesEndpoint,
|
||||||
|
{ build_type: 'workflow' },
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/vnd.github.v3+json',
|
||||||
|
Authorization: `Bearer ${githubToken}`,
|
||||||
|
'Content-type': 'application/json'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
const pageObject = response.data
|
||||||
|
return pageObject
|
||||||
|
} catch (error) {
|
||||||
|
if (error.response && error.response.status === 409) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getPagesSite({ repositoryNwo, githubToken }) {
|
||||||
|
try {
|
||||||
|
const pagesEndpoint = `https://api.github.com/repos/${repositoryNwo}/pages`
|
||||||
|
|
||||||
|
const response = await axios.get(pagesEndpoint, {
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/vnd.github.v3+json',
|
||||||
|
Authorization: `Bearer ${githubToken}`
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const pageObject = response.data
|
||||||
|
return pageObject
|
||||||
|
} catch (error) {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function findOrCreatePagesSite({ repositoryNwo, githubToken, enablement = true }) {
|
||||||
|
let pageObject
|
||||||
|
|
||||||
|
// Try to find an existing Pages site first
|
||||||
|
try {
|
||||||
|
pageObject = await getPagesSite({ repositoryNwo, githubToken })
|
||||||
|
} catch (error) {
|
||||||
|
if (!enablement) {
|
||||||
|
core.error('Get Pages site failed', error)
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
core.warning('Get Pages site failed', error)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pageObject && enablement) {
|
||||||
|
// Create a new Pages site if one doesn't exist
|
||||||
|
try {
|
||||||
|
pageObject = await enablePagesSite({ repositoryNwo, githubToken })
|
||||||
|
} catch (error) {
|
||||||
|
core.error('Create Pages site failed', error)
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
|
||||||
|
// This somehow implies that the Pages site was already created but initially failed to be retrieved.
|
||||||
|
// Try one more time for this extreme edge case!
|
||||||
|
if (pageObject == null) {
|
||||||
|
try {
|
||||||
|
pageObject = await getPagesSite({ repositoryNwo, githubToken })
|
||||||
|
} catch (error) {
|
||||||
|
core.error('Get Pages site still failed', error)
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return pageObject
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { findOrCreatePagesSite, enablePagesSite, getPagesSite }
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 8395:
|
/***/ 8395:
|
||||||
@@ -14740,85 +14834,19 @@ module.exports = {getContext}
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
/***/ 5424:
|
/***/ 7527:
|
||||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||||
|
|
||||||
const core = __nccwpck_require__(2186)
|
const core = __nccwpck_require__(2186)
|
||||||
const axios = __nccwpck_require__(6545)
|
|
||||||
|
|
||||||
async function enablePages({repositoryNwo, githubToken}) {
|
function outputPagesBaseUrl(siteUrl) {
|
||||||
const pagesEndpoint = `https://api.github.com/repos/${repositoryNwo}/pages`
|
core.setOutput('base_url', siteUrl.href)
|
||||||
|
core.setOutput('origin', siteUrl.origin)
|
||||||
try {
|
core.setOutput('host', siteUrl.host)
|
||||||
const response = await axios.post(
|
core.setOutput('base_path', siteUrl.pathname)
|
||||||
pagesEndpoint,
|
|
||||||
{build_type: 'workflow'},
|
|
||||||
{
|
|
||||||
headers: {
|
|
||||||
Accept: 'application/vnd.github.v3+json',
|
|
||||||
Authorization: `Bearer ${githubToken}`,
|
|
||||||
'Content-type': 'application/json'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
core.info('Created pages site')
|
|
||||||
} catch (error) {
|
|
||||||
if (error.response && error.response.status === 409) {
|
|
||||||
core.info('Pages site exists')
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
core.error("Couldn't create pages site", error)
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = enablePages
|
module.exports = outputPagesBaseUrl
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 9965:
|
|
||||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
||||||
|
|
||||||
const core = __nccwpck_require__(2186)
|
|
||||||
const axios = __nccwpck_require__(6545)
|
|
||||||
const {setPagesPath} = __nccwpck_require__(4770)
|
|
||||||
|
|
||||||
async function getPagesBaseUrl({
|
|
||||||
repositoryNwo,
|
|
||||||
githubToken,
|
|
||||||
staticSiteGenerator
|
|
||||||
}) {
|
|
||||||
try {
|
|
||||||
const pagesEndpoint = `https://api.github.com/repos/${repositoryNwo}/pages`
|
|
||||||
|
|
||||||
core.info(`Get the Base URL to the page with endpoint ${pagesEndpoint}`)
|
|
||||||
const response = await axios.get(pagesEndpoint, {
|
|
||||||
headers: {
|
|
||||||
Accept: 'application/vnd.github.v3+json',
|
|
||||||
Authorization: `Bearer ${githubToken}`
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
pageObject = response.data
|
|
||||||
core.info(JSON.stringify(pageObject))
|
|
||||||
|
|
||||||
const siteUrl = new URL(pageObject.html_url)
|
|
||||||
if (staticSiteGenerator) {
|
|
||||||
setPagesPath({staticSiteGenerator, path: siteUrl.pathname})
|
|
||||||
}
|
|
||||||
core.setOutput('base_url', siteUrl.href)
|
|
||||||
core.setOutput('origin', siteUrl.origin)
|
|
||||||
core.setOutput('host', siteUrl.host)
|
|
||||||
core.setOutput('base_path', siteUrl.pathname)
|
|
||||||
} catch (error) {
|
|
||||||
core.error('Get on the Page failed', error)
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = getPagesBaseUrl
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@@ -16376,19 +16404,24 @@ var __webpack_exports__ = {};
|
|||||||
(() => {
|
(() => {
|
||||||
const core = __nccwpck_require__(2186)
|
const core = __nccwpck_require__(2186)
|
||||||
|
|
||||||
const enablePages = __nccwpck_require__(5424)
|
|
||||||
const getPagesBaseUrl = __nccwpck_require__(9965)
|
|
||||||
|
|
||||||
// All variables we need from the runtime are loaded here
|
// All variables we need from the runtime are loaded here
|
||||||
const {getContext} = __nccwpck_require__(1319)
|
const { getContext } = __nccwpck_require__(1319)
|
||||||
|
|
||||||
|
const { findOrCreatePagesSite } = __nccwpck_require__(9432)
|
||||||
|
const { setPagesPath } = __nccwpck_require__(4770)
|
||||||
|
const outputPagesBaseUrl = __nccwpck_require__(7527)
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
try {
|
try {
|
||||||
const context = getContext()
|
const { repositoryNwo, githubToken, enablement, staticSiteGenerator } = getContext()
|
||||||
if (context.enablement) {
|
|
||||||
await enablePages(context)
|
const pageObject = await findOrCreatePagesSite({ repositoryNwo, githubToken, enablement })
|
||||||
|
const siteUrl = new URL(pageObject.html_url)
|
||||||
|
|
||||||
|
if (staticSiteGenerator) {
|
||||||
|
setPagesPath({ staticSiteGenerator, path: siteUrl.pathname })
|
||||||
}
|
}
|
||||||
await getPagesBaseUrl(context)
|
outputPagesBaseUrl(siteUrl)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error)
|
core.setFailed(error)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
|
|||||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user