mirror of
https://github.com/actions/deploy-pages.git
synced 2026-02-11 04:41:26 +00:00
publish to actions org
This commit is contained in:
26
src/context.js
Normal file
26
src/context.js
Normal file
@@ -0,0 +1,26 @@
|
||||
const core = require('@actions/core')
|
||||
|
||||
// Load variables from Actions runtime
|
||||
function getRequiredVars() {
|
||||
return {
|
||||
runTimeUrl: process.env.ACTIONS_RUNTIME_URL,
|
||||
workflowRun: process.env.GITHUB_RUN_ID,
|
||||
runTimeToken: process.env.ACTIONS_RUNTIME_TOKEN,
|
||||
repositoryNwo: process.env.GITHUB_REPOSITORY,
|
||||
buildVersion: process.env.GITHUB_SHA,
|
||||
buildActor: process.env.GITHUB_ACTOR,
|
||||
actionsId: process.env.GITHUB_ACTION,
|
||||
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