mirror of
https://github.com/FranzDiebold/github-env-vars-action.git
synced 2024-11-26 10:41:06 -05:00
Switch to a Docker container action.
This commit is contained in:
parent
e050e21c8f
commit
dbbf375c45
7 changed files with 52 additions and 456 deletions
8
Dockerfile
Normal file
8
Dockerfile
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Container image that runs your code
|
||||||
|
FROM alpine:3.10
|
||||||
|
|
||||||
|
# Copies your code file from your action repository to the filesystem path `/` of the container
|
||||||
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
|
# Code file to execute when the docker container starts up (`entrypoint.sh`)
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
32
README.md
32
README.md
|
@ -1,15 +1,37 @@
|
||||||
# :octocat: :rocket: GitHub Environment Variables Action
|
# :octocat: :rocket: GitHub Environment Variables Action
|
||||||
|
|
||||||
A [GitHub Action](https://github.com/features/actions) to expose useful environment variables:
|
A [GitHub Action](https://github.com/features/actions) to expose useful environment variables.
|
||||||
|
|
||||||
|
### Environment Variables exposed by **this Action**
|
||||||
|
|
||||||
| Environment Variable Name | Example value |
|
| Environment Variable Name | Example value |
|
||||||
|---------------------------|---------------------------|
|
|---------------------------|---------------------------|
|
||||||
| `GITHUB_REPO_OWNER` | `franzdiebold` |
|
| `GITHUB_REPOSITORY_OWNER` | `FranzDiebold` |
|
||||||
| `GITHUB_REPO_NAME` | `github-env-vars-action` |
|
| `GITHUB_REPOSITORY_NAME` | `github-env-vars-action` |
|
||||||
| `GITHUB_BRANCH_NAME` | `feature-branch-1` |
|
| `GITHUB_REF_NAME` | `feature-branch-1` |
|
||||||
|
| `GITHUB_SHA_SHORT` | `ffac537e` |
|
||||||
|
|
||||||
|
|
||||||
|
### Default Environment Variables exposed by GitHub
|
||||||
|
|
||||||
|
For a full list of default environment variables exposed by GitHub see [https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables](https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables).
|
||||||
|
|
||||||
|
| Environment Variable Name | Example value |
|
||||||
|
|---------------------------|-----------------------------------------------|
|
||||||
|
| `GITHUB_ACTOR` | `octocat` |
|
||||||
|
| `GITHUB_REPOSITORY` | `FranzDiebold/github-env-vars-action` |
|
||||||
|
| `GITHUB_SHA` | `ffac537e6cbbf934b08745a378932722df287a53` |
|
||||||
|
| `GITHUB_REF` | `refs/heads/feature-branch-1` |
|
||||||
|
|
||||||
## Example usage
|
## Example usage
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: franzdiebold@github-env-vars-action@master
|
steps:
|
||||||
|
- uses: franzdiebold@github-env-vars-action@master
|
||||||
|
- name: Print environment variables
|
||||||
|
run: |
|
||||||
|
echo "GITHUB_REPOSITORY_OWNER=$GITHUB_REPOSITORY_OWNER"
|
||||||
|
echo "GITHUB_REPOSITORY_NAME=$GITHUB_REPOSITORY_NAME"
|
||||||
|
echo "GITHUB_REF_NAME=$GITHUB_REF_NAME"
|
||||||
|
echo "GITHUB_SHA_SHORT=$GITHUB_SHA_SHORT"
|
||||||
```
|
```
|
||||||
|
|
388
dist/index.js
vendored
388
dist/index.js
vendored
|
@ -1,388 +0,0 @@
|
||||||
module.exports =
|
|
||||||
/******/ (function(modules, runtime) { // webpackBootstrap
|
|
||||||
/******/ "use strict";
|
|
||||||
/******/ // The module cache
|
|
||||||
/******/ var installedModules = {};
|
|
||||||
/******/
|
|
||||||
/******/ // The require function
|
|
||||||
/******/ function __webpack_require__(moduleId) {
|
|
||||||
/******/
|
|
||||||
/******/ // Check if module is in cache
|
|
||||||
/******/ if(installedModules[moduleId]) {
|
|
||||||
/******/ return installedModules[moduleId].exports;
|
|
||||||
/******/ }
|
|
||||||
/******/ // Create a new module (and put it into the cache)
|
|
||||||
/******/ var module = installedModules[moduleId] = {
|
|
||||||
/******/ i: moduleId,
|
|
||||||
/******/ l: false,
|
|
||||||
/******/ exports: {}
|
|
||||||
/******/ };
|
|
||||||
/******/
|
|
||||||
/******/ // Execute the module function
|
|
||||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
||||||
/******/
|
|
||||||
/******/ // Flag the module as loaded
|
|
||||||
/******/ module.l = true;
|
|
||||||
/******/
|
|
||||||
/******/ // Return the exports of the module
|
|
||||||
/******/ return module.exports;
|
|
||||||
/******/ }
|
|
||||||
/******/
|
|
||||||
/******/
|
|
||||||
/******/ __webpack_require__.ab = __dirname + "/";
|
|
||||||
/******/
|
|
||||||
/******/ // the startup function
|
|
||||||
/******/ function startup() {
|
|
||||||
/******/ // Load entry module and return exports
|
|
||||||
/******/ return __webpack_require__(622);
|
|
||||||
/******/ };
|
|
||||||
/******/
|
|
||||||
/******/ // run startup
|
|
||||||
/******/ return startup();
|
|
||||||
/******/ })
|
|
||||||
/************************************************************************/
|
|
||||||
/******/ ({
|
|
||||||
|
|
||||||
/***/ 87:
|
|
||||||
/***/ (function(module) {
|
|
||||||
|
|
||||||
module.exports = require("os");
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 215:
|
|
||||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
||||||
result["default"] = mod;
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const os = __importStar(__webpack_require__(87));
|
|
||||||
/**
|
|
||||||
* Commands
|
|
||||||
*
|
|
||||||
* Command Format:
|
|
||||||
* ::name key=value,key=value::message
|
|
||||||
*
|
|
||||||
* Examples:
|
|
||||||
* ::warning::This is the message
|
|
||||||
* ::set-env name=MY_VAR::some value
|
|
||||||
*/
|
|
||||||
function issueCommand(command, properties, message) {
|
|
||||||
const cmd = new Command(command, properties, message);
|
|
||||||
process.stdout.write(cmd.toString() + os.EOL);
|
|
||||||
}
|
|
||||||
exports.issueCommand = issueCommand;
|
|
||||||
function issue(name, message = '') {
|
|
||||||
issueCommand(name, {}, message);
|
|
||||||
}
|
|
||||||
exports.issue = issue;
|
|
||||||
const CMD_STRING = '::';
|
|
||||||
class Command {
|
|
||||||
constructor(command, properties, message) {
|
|
||||||
if (!command) {
|
|
||||||
command = 'missing.command';
|
|
||||||
}
|
|
||||||
this.command = command;
|
|
||||||
this.properties = properties;
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
toString() {
|
|
||||||
let cmdStr = CMD_STRING + this.command;
|
|
||||||
if (this.properties && Object.keys(this.properties).length > 0) {
|
|
||||||
cmdStr += ' ';
|
|
||||||
let first = true;
|
|
||||||
for (const key in this.properties) {
|
|
||||||
if (this.properties.hasOwnProperty(key)) {
|
|
||||||
const val = this.properties[key];
|
|
||||||
if (val) {
|
|
||||||
if (first) {
|
|
||||||
first = false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cmdStr += ',';
|
|
||||||
}
|
|
||||||
cmdStr += `${key}=${escapeProperty(val)}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
|
|
||||||
return cmdStr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function escapeData(s) {
|
|
||||||
return (s || '')
|
|
||||||
.replace(/%/g, '%25')
|
|
||||||
.replace(/\r/g, '%0D')
|
|
||||||
.replace(/\n/g, '%0A');
|
|
||||||
}
|
|
||||||
function escapeProperty(s) {
|
|
||||||
return (s || '')
|
|
||||||
.replace(/%/g, '%25')
|
|
||||||
.replace(/\r/g, '%0D')
|
|
||||||
.replace(/\n/g, '%0A')
|
|
||||||
.replace(/:/g, '%3A')
|
|
||||||
.replace(/,/g, '%2C');
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=command.js.map
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 277:
|
|
||||||
/***/ (function(module) {
|
|
||||||
|
|
||||||
module.exports = require("path");
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 622:
|
|
||||||
/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) {
|
|
||||||
|
|
||||||
const core = __webpack_require__(827);
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
|
||||||
|
|
||||||
/***/ 827:
|
|
||||||
/***/ (function(__unusedmodule, exports, __webpack_require__) {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
||||||
result["default"] = mod;
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const command_1 = __webpack_require__(215);
|
|
||||||
const os = __importStar(__webpack_require__(87));
|
|
||||||
const path = __importStar(__webpack_require__(277));
|
|
||||||
/**
|
|
||||||
* The code to exit an action
|
|
||||||
*/
|
|
||||||
var ExitCode;
|
|
||||||
(function (ExitCode) {
|
|
||||||
/**
|
|
||||||
* A code indicating that the action was successful
|
|
||||||
*/
|
|
||||||
ExitCode[ExitCode["Success"] = 0] = "Success";
|
|
||||||
/**
|
|
||||||
* A code indicating that the action was a failure
|
|
||||||
*/
|
|
||||||
ExitCode[ExitCode["Failure"] = 1] = "Failure";
|
|
||||||
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
// Variables
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* Sets env variable for this action and future actions in the job
|
|
||||||
* @param name the name of the variable to set
|
|
||||||
* @param val the value of the variable
|
|
||||||
*/
|
|
||||||
function exportVariable(name, val) {
|
|
||||||
process.env[name] = val;
|
|
||||||
command_1.issueCommand('set-env', { name }, val);
|
|
||||||
}
|
|
||||||
exports.exportVariable = exportVariable;
|
|
||||||
/**
|
|
||||||
* Registers a secret which will get masked from logs
|
|
||||||
* @param secret value of the secret
|
|
||||||
*/
|
|
||||||
function setSecret(secret) {
|
|
||||||
command_1.issueCommand('add-mask', {}, secret);
|
|
||||||
}
|
|
||||||
exports.setSecret = setSecret;
|
|
||||||
/**
|
|
||||||
* Prepends inputPath to the PATH (for this action and future actions)
|
|
||||||
* @param inputPath
|
|
||||||
*/
|
|
||||||
function addPath(inputPath) {
|
|
||||||
command_1.issueCommand('add-path', {}, inputPath);
|
|
||||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
|
||||||
}
|
|
||||||
exports.addPath = addPath;
|
|
||||||
/**
|
|
||||||
* Gets the value of an input. The value is also trimmed.
|
|
||||||
*
|
|
||||||
* @param name name of the input to get
|
|
||||||
* @param options optional. See InputOptions.
|
|
||||||
* @returns string
|
|
||||||
*/
|
|
||||||
function getInput(name, options) {
|
|
||||||
const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
|
|
||||||
if (options && options.required && !val) {
|
|
||||||
throw new Error(`Input required and not supplied: ${name}`);
|
|
||||||
}
|
|
||||||
return val.trim();
|
|
||||||
}
|
|
||||||
exports.getInput = getInput;
|
|
||||||
/**
|
|
||||||
* Sets the value of an output.
|
|
||||||
*
|
|
||||||
* @param name name of the output to set
|
|
||||||
* @param value value to store
|
|
||||||
*/
|
|
||||||
function setOutput(name, value) {
|
|
||||||
command_1.issueCommand('set-output', { name }, value);
|
|
||||||
}
|
|
||||||
exports.setOutput = setOutput;
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
// Results
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* Sets the action status to failed.
|
|
||||||
* When the action exits it will be with an exit code of 1
|
|
||||||
* @param message add error issue message
|
|
||||||
*/
|
|
||||||
function setFailed(message) {
|
|
||||||
process.exitCode = ExitCode.Failure;
|
|
||||||
error(message);
|
|
||||||
}
|
|
||||||
exports.setFailed = setFailed;
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
// Logging Commands
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* Writes debug message to user log
|
|
||||||
* @param message debug message
|
|
||||||
*/
|
|
||||||
function debug(message) {
|
|
||||||
command_1.issueCommand('debug', {}, message);
|
|
||||||
}
|
|
||||||
exports.debug = debug;
|
|
||||||
/**
|
|
||||||
* Adds an error issue
|
|
||||||
* @param message error issue message
|
|
||||||
*/
|
|
||||||
function error(message) {
|
|
||||||
command_1.issue('error', message);
|
|
||||||
}
|
|
||||||
exports.error = error;
|
|
||||||
/**
|
|
||||||
* Adds an warning issue
|
|
||||||
* @param message warning issue message
|
|
||||||
*/
|
|
||||||
function warning(message) {
|
|
||||||
command_1.issue('warning', message);
|
|
||||||
}
|
|
||||||
exports.warning = warning;
|
|
||||||
/**
|
|
||||||
* Writes info to log with console.log.
|
|
||||||
* @param message info message
|
|
||||||
*/
|
|
||||||
function info(message) {
|
|
||||||
process.stdout.write(message + os.EOL);
|
|
||||||
}
|
|
||||||
exports.info = info;
|
|
||||||
/**
|
|
||||||
* Begin an output group.
|
|
||||||
*
|
|
||||||
* Output until the next `groupEnd` will be foldable in this group
|
|
||||||
*
|
|
||||||
* @param name The name of the output group
|
|
||||||
*/
|
|
||||||
function startGroup(name) {
|
|
||||||
command_1.issue('group', name);
|
|
||||||
}
|
|
||||||
exports.startGroup = startGroup;
|
|
||||||
/**
|
|
||||||
* End an output group.
|
|
||||||
*/
|
|
||||||
function endGroup() {
|
|
||||||
command_1.issue('endgroup');
|
|
||||||
}
|
|
||||||
exports.endGroup = endGroup;
|
|
||||||
/**
|
|
||||||
* Wrap an asynchronous function call in a group.
|
|
||||||
*
|
|
||||||
* Returns the same type as the function itself.
|
|
||||||
*
|
|
||||||
* @param name The name of the group
|
|
||||||
* @param fn The function to wrap in the group
|
|
||||||
*/
|
|
||||||
function group(name, fn) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
startGroup(name);
|
|
||||||
let result;
|
|
||||||
try {
|
|
||||||
result = yield fn();
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
endGroup();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.group = group;
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
// Wrapper action state
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* Saves state for current action, the state can only be retrieved by this action's post job execution.
|
|
||||||
*
|
|
||||||
* @param name name of the state to store
|
|
||||||
* @param value value to store
|
|
||||||
*/
|
|
||||||
function saveState(name, value) {
|
|
||||||
command_1.issueCommand('save-state', { name }, value);
|
|
||||||
}
|
|
||||||
exports.saveState = saveState;
|
|
||||||
/**
|
|
||||||
* Gets the value of an state set by this action's main execution.
|
|
||||||
*
|
|
||||||
* @param name name of the state to get
|
|
||||||
* @returns string
|
|
||||||
*/
|
|
||||||
function getState(name) {
|
|
||||||
return process.env[`STATE_${name}`] || '';
|
|
||||||
}
|
|
||||||
exports.getState = getState;
|
|
||||||
//# sourceMappingURL=core.js.map
|
|
||||||
|
|
||||||
/***/ })
|
|
||||||
|
|
||||||
/******/ });
|
|
17
entrypoint.sh
Normal file
17
entrypoint.sh
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/sh -l
|
||||||
|
|
||||||
|
GITHUB_REPOSITORY_OWNER=$(echo $GITHUB_REPOSITORY | cut -d'/' -f 1)
|
||||||
|
echo "::set-env name=GITHUB_REPOSITORY_OWNER::$GITHUB_REPOSITORY_OWNER"
|
||||||
|
echo "Set GITHUB_REPOSITORY_OWNER=$GITHUB_REPOSITORY_OWNER"
|
||||||
|
|
||||||
|
GITHUB_REPOSITORY_NAME=$(echo $GITHUB_REPOSITORY | cut -d'/' -f 2)
|
||||||
|
echo "::set-env name=GITHUB_REPOSITORY_NAME::$GITHUB_REPOSITORY_NAME"
|
||||||
|
echo "Set GITHUB_REPOSITORY_NAME=$GITHUB_REPOSITORY_NAME"
|
||||||
|
|
||||||
|
GITHUB_REF_NAME=$(echo $GITHUB_REF | cut -d'/' -f 3)
|
||||||
|
echo "::set-env name=GITHUB_REF_NAME::$GITHUB_REF_NAME"
|
||||||
|
echo "Set GITHUB_REF_NAME=$GITHUB_REF_NAME"
|
||||||
|
|
||||||
|
GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c1-8)
|
||||||
|
echo "::set-env name=GITHUB_SHA_SHORT::$GITHUB_SHA_SHORT"
|
||||||
|
echo "Set GITHUB_SHA_SHORT=$GITHUB_SHA_SHORT"
|
27
index.js
27
index.js
|
@ -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);
|
|
||||||
}
|
|
13
package-lock.json
generated
13
package-lock.json
generated
|
@ -1,13 +0,0 @@
|
||||||
{
|
|
||||||
"name": "github-env-vars-action",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"lockfileVersion": 1,
|
|
||||||
"requires": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@actions/core": {
|
|
||||||
"version": "1.2.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.2.tgz",
|
|
||||||
"integrity": "sha512-IbCx7oefq+Gi6FWbSs2Fnw8VkEI6Y4gvjrYprY3RV//ksq/KPMlClOerJ4jRosyal6zkUIc8R9fS/cpRMlGClg=="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
23
package.json
23
package.json
|
@ -1,23 +0,0 @@
|
||||||
{
|
|
||||||
"name": "github-env-vars-action",
|
|
||||||
"version": "0.0.1",
|
|
||||||
"description": "GitHub Action to expose useful Environment Variables.",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"build": "ncc build index.js",
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/FranzDiebold/github-env-vars-action.git"
|
|
||||||
},
|
|
||||||
"author": "Franz Diebold",
|
|
||||||
"license": "MIT",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/FranzDiebold/github-env-vars-action/issues"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/FranzDiebold/github-env-vars-action#readme",
|
|
||||||
"dependencies": {
|
|
||||||
"@actions/core": "^1.2.2"
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue