Before return site domain & path, create the site

This commit is contained in:
Jess Bees
2022-06-13 17:10:28 -04:00
parent dabdcba737
commit a0e3ad5b25
5 changed files with 122 additions and 1 deletions

40
dist/index.js vendored
View File

@@ -8078,6 +8078,44 @@ module.exports = function getContext() {
}
/***/ }),
/***/ 5424:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
const core = __nccwpck_require__(2186)
const axios = __nccwpck_require__(6545)
async function enablePages({ repositoryNwo, githubToken }) {
const pagesEndpoint = `https://api.github.com/repos/${repositoryNwo}/pages`
try {
const response = await axios.post(
pagesEndpoint,
{
headers: {
Accept: 'application/vnd.github.v3+json',
Authorization: `Bearer ${githubToken}`,
'Content-type': 'application/json',
},
body: JSON.stringify({ build_type: 'workflow' }),
}
)
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
/***/ }),
/***/ 9965:
@@ -8283,6 +8321,7 @@ var __webpack_exports__ = {};
(() => {
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
@@ -8291,6 +8330,7 @@ const getContext = __nccwpck_require__(1319)
async function main() {
try {
const context = getContext()
await enablePages(context)
await getPagesBaseUrl(context)
} catch (error) {
core.setFailed(error)

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long