mirror of
https://github.com/actions/configure-pages.git
synced 2025-12-08 08:06:09 +00:00
Add token input
This commit is contained in:
38
dist/index.js
vendored
38
dist/index.js
vendored
@@ -8051,6 +8051,33 @@ if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) {
|
||||
exports.debug = debug; // for test
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 1319:
|
||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||
|
||||
const core = __nccwpck_require__(2186)
|
||||
|
||||
// Load variables from Actions runtime
|
||||
function getRequiredVars() {
|
||||
return {
|
||||
repositoryNwo: process.env.GITHUB_REPOSITORY,
|
||||
githubToken: core.getInput('token')
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function getContext() {
|
||||
const requiredVars = getRequiredVars()
|
||||
for (const variable in requiredVars) {
|
||||
if (requiredVars[variable] === undefined) {
|
||||
throw new Error(`${variable} is undefined. Cannot continue.`)
|
||||
}
|
||||
}
|
||||
core.debug('all variables are set')
|
||||
return requiredVars
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9491:
|
||||
@@ -8217,18 +8244,23 @@ var __webpack_exports__ = {};
|
||||
const core = __nccwpck_require__(2186)
|
||||
const axios = __nccwpck_require__(6545)
|
||||
|
||||
// All variables we need from the runtime are loaded here
|
||||
const getContext = __nccwpck_require__(1319)
|
||||
|
||||
async function getPageBaseUrl() {
|
||||
try {
|
||||
const pagesEndpoint = `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages`
|
||||
const context = getContext()
|
||||
|
||||
const pagesEndpoint = `https://api.github.com/repos/${context.repositoryNwo}/pages`
|
||||
|
||||
core.info("GITHUB_TOKEN : " + process.env.GITHUB_TOKEN)
|
||||
core.info("GITHUB_TOKEN : " + context.githubToken)
|
||||
|
||||
const response = await axios.get(
|
||||
pagesEndpoint,
|
||||
{
|
||||
headers: {
|
||||
Accept: 'application/vnd.github.v3+json',
|
||||
Authorization: `Bearer ${process.env.GITHUB_TOKEN}`
|
||||
Authorization: `Bearer ${context.githubToken}`
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
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