mirror of
https://github.com/actions/configure-pages.git
synced 2025-12-09 00:26:08 +00:00
Create context.js
This commit is contained in:
19
src/context.js
Normal file
19
src/context.js
Normal file
@@ -0,0 +1,19 @@
|
||||
const core = require('@actions/core')
|
||||
|
||||
// Load variables from Actions runtime
|
||||
function getRequiredVars() {
|
||||
return {
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user