Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
deploy-pages/src/context.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
29 lines (27 sloc)
992 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'), | |
githubApiUrl: process.env.GITHUB_API_URL ?? 'https://api.github.com', | |
artifactName: core.getInput('artifact_name') ?? 'github-pages', | |
isPreview: core.getInput('preview') === 'true' | |
} | |
} | |
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 | |
} |