forked from falti/dotenv-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
33 lines (29 loc) · 886 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const core = require('@actions/core');
const dotenvAction = require('./dotenv_action');
try {
const dotenvFile = core.getInput('path');
const logVariables = core.getInput('log-variables').toLowerCase() === 'true';
const maskVariables =
core.getInput('mask-variables').toLowerCase() === 'true';
const variables = dotenvAction(dotenvFile, logVariables);
if (maskVariables) {
for (const key in variables) {
const value = variables[key];
core.setSecret(value);
}
}
if (logVariables) {
console.log(variables);
} else {
console.log(
`loaded ${Object.keys(variables).length} values into the environment`
);
}
core.setOutput('generic', 'please check for actual outputs');
for (const key in variables) {
const value = variables[key];
core.setOutput(key, value);
}
} catch (error) {
core.setFailed(error.message);
}