mirror of
https://github.com/actions/configure-pages.git
synced 2025-12-08 08:06:09 +00:00
28 lines
792 B
JavaScript
28 lines
792 B
JavaScript
const core = require('@actions/core')
|
|
|
|
// Load variables from Actions runtime
|
|
function getRequiredVars() {
|
|
return {
|
|
repositoryNwo: process.env.GITHUB_REPOSITORY,
|
|
githubToken: core.getInput('token'),
|
|
staticSiteGenerator: core.getInput('static_site_generator'),
|
|
generatorConfigFile: core.getInput('generator_config_file'),
|
|
proxy: core.getInput('proxy'),
|
|
enablement: core.getInput('enablement') === 'true'
|
|
}
|
|
}
|
|
|
|
// Return the context object
|
|
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
|
|
}
|
|
|
|
module.exports = { getContext }
|