2022-06-07 22:15:39 -07:00
|
|
|
const core = require('@actions/core')
|
|
|
|
|
|
|
|
|
|
// Load variables from Actions runtime
|
|
|
|
|
function getRequiredVars() {
|
|
|
|
|
return {
|
2022-06-07 22:18:54 -07:00
|
|
|
repositoryNwo: process.env.GITHUB_REPOSITORY,
|
2022-06-16 14:28:43 -07:00
|
|
|
githubToken: core.getInput('token'),
|
|
|
|
|
staticSiteGenerator: core.getInput('static_site_generator')
|
2022-06-07 22:15:39 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
}
|