mirror of
https://github.com/actions/configure-pages.git
synced 2026-03-30 01:54:51 +00:00
Add token input
This commit is contained in:
@@ -3,6 +3,11 @@ description: 'Get the base URL where the GitHub Pages site will be hosted'
|
|||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node16'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
inputs:
|
||||||
|
token:
|
||||||
|
description: 'GitHub token'
|
||||||
|
default: ${{ github.token }}
|
||||||
|
required: true
|
||||||
outputs:
|
outputs:
|
||||||
base_url:
|
base_url:
|
||||||
description: 'URL to deployed GitHub Pages'
|
description: 'URL to deployed GitHub Pages'
|
||||||
|
|||||||
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
|
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:
|
/***/ 9491:
|
||||||
@@ -8217,18 +8244,23 @@ var __webpack_exports__ = {};
|
|||||||
const core = __nccwpck_require__(2186)
|
const core = __nccwpck_require__(2186)
|
||||||
const axios = __nccwpck_require__(6545)
|
const axios = __nccwpck_require__(6545)
|
||||||
|
|
||||||
|
// All variables we need from the runtime are loaded here
|
||||||
|
const getContext = __nccwpck_require__(1319)
|
||||||
|
|
||||||
async function getPageBaseUrl() {
|
async function getPageBaseUrl() {
|
||||||
try {
|
try {
|
||||||
const pagesEndpoint = `https://api.github.com/repos/${process.env.GITHUB_REPOSITORY}/pages`
|
const context = getContext()
|
||||||
|
|
||||||
core.info("GITHUB_TOKEN : " + process.env.GITHUB_TOKEN)
|
const pagesEndpoint = `https://api.github.com/repos/${context.repositoryNwo}/pages`
|
||||||
|
|
||||||
|
core.info("GITHUB_TOKEN : " + context.githubToken)
|
||||||
|
|
||||||
const response = await axios.get(
|
const response = await axios.get(
|
||||||
pagesEndpoint,
|
pagesEndpoint,
|
||||||
{
|
{
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/vnd.github.v3+json',
|
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