Switch to a Docker container action.

This commit is contained in:
Franz Diebold 2020-02-11 10:30:39 +01:00
parent e050e21c8f
commit dbbf375c45
7 changed files with 52 additions and 456 deletions

View file

@ -1,27 +0,0 @@
const core = require('@actions/core');
function slugify(str) {
str = str.replace(/^\s+|\s+$/g, ''); // trim
str = str.toLowerCase();
str = str.replace(/[^a-z0-9 -]/g, '') // remove invalid chars
.replace(/\s+/g, '-') // collapse whitespace and replace by -
.replace(/-+/g, '-'); // collapse dashes
return 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
core.exportVariable('GITHUB_REPO_OWNER', slugify(splitted_github_repository[0]));
core.info(`Set GITHUB_REPO_OWNER=${process.env.GITHUB_REPO_OWNER}`);
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
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);
}