Add token input

This commit is contained in:
Smitha Borkar
2022-06-07 22:21:50 -07:00
parent 43507179c9
commit 94028786d7
3 changed files with 41 additions and 4 deletions

38
dist/index.js vendored
View File

@@ -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

File diff suppressed because one or more lines are too long