Skip to content

Commit

Permalink
Create context.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Smitha Borkar authored and GitHub committed Jun 8, 2022
1 parent 07e8c60 commit ad7ab3a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/context.js
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit ad7ab3a

Please sign in to comment.