Fix environment variable export.

This commit is contained in:
Franz Diebold 2020-02-11 08:56:10 +01:00
parent 7fed643c47
commit 64bf94c273
2 changed files with 6 additions and 6 deletions

6
dist/index.js vendored
View file

@ -161,13 +161,13 @@ function slugify(str) {
// https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-environment-variables#default-environment-variables
try {
splitted_github_repository = process.env.GITHUB_REPOSITORY.split('/'); // octocat/Hello-World
process.env['GITHUB_REPO_OWNER'] = slugify(splitted_github_repository[0]);
core.exportVariable('GITHUB_REPO_OWNER', slugify(splitted_github_repository[0]));
core.info(`Set GITHUB_REPO_OWNER=${process.env.GITHUB_REPO_OWNER}`);
process.env['GITHUB_REPO_NAME'] = slugify(splitted_github_repository[1]);
core.exportVariable('GITHUB_REPO_NAME', slugify(splitted_github_repository[1]));
core.info(`Set GITHUB_REPO_NAME=${process.env.GITHUB_REPO_NAME}`);
splitted_github_ref = process.env.GITHUB_REF.split('/'); // refs/heads/feature-branch-1
process.env['GITHUB_BRANCH_NAME'] = slugify(splitted_github_ref[2]);
core.exportVariable('GITHUB_BRANCH_NAME', slugify(splitted_github_ref[2]));
core.info(`Set GITHUB_BRANCH_NAME=${process.env.GITHUB_BRANCH_NAME}`);
} catch (error) {
core.setFailed(error.message);

View file

@ -14,13 +14,13 @@ function slugify(str) {
// https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-environment-variables#default-environment-variables
try {
splitted_github_repository = process.env.GITHUB_REPOSITORY.split('/'); // octocat/Hello-World
process.env['GITHUB_REPO_OWNER'] = slugify(splitted_github_repository[0]);
core.exportVariable('GITHUB_REPO_OWNER', slugify(splitted_github_repository[0]));
core.info(`Set GITHUB_REPO_OWNER=${process.env.GITHUB_REPO_OWNER}`);
process.env['GITHUB_REPO_NAME'] = slugify(splitted_github_repository[1]);
core.exportVariable('GITHUB_REPO_NAME', slugify(splitted_github_repository[1]));
core.info(`Set GITHUB_REPO_NAME=${process.env.GITHUB_REPO_NAME}`);
splitted_github_ref = process.env.GITHUB_REF.split('/'); // refs/heads/feature-branch-1
process.env['GITHUB_BRANCH_NAME'] = slugify(splitted_github_ref[2]);
core.exportVariable('GITHUB_BRANCH_NAME', slugify(splitted_github_ref[2]));
core.info(`Set GITHUB_BRANCH_NAME=${process.env.GITHUB_BRANCH_NAME}`);
} catch (error) {
core.setFailed(error.message);