@actions/core#exportVariable TypeScript Examples

The following examples show how to use @actions/core#exportVariable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: addEnv.ts    From setup-cpp with Apache License 2.0 6 votes vote down vote up
/** An add path function that works locally or inside GitHub Actions */
export async function addEnv(name: string, valGiven: string | undefined, shouldEscapeSpace: boolean = false) {
  const val = shouldEscapeSpace ? escapeSpace(valGiven) : valGiven
  try {
    if (isGitHubCI()) {
      try {
        exportVariable(name, val)
      } catch (err) {
        error(err as Error)
        await addEnvSystem(name, val)
      }
    } else {
      await addEnvSystem(name, val)
    }
  } catch (err) {
    error(err as Error)
    setFailed(`Failed to export environment variable ${name}=${val}. You should add it manually.`)
  }
}
Example #2
Source File: ci-login.ts    From cli with Apache License 2.0 5 votes vote down vote up
async function outputCliConfig() {
  const config = getConfig();
  setSecret(config.accessToken);
  exportVariable('CLI_CONFIG_PATH', getConfigFilePath());
}