-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.js
More file actions
30 lines (26 loc) · 1.15 KB
/
index.js
File metadata and controls
30 lines (26 loc) · 1.15 KB
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
const core = require('@actions/core');
const tools = require('./src/tools');
const {puppetRun} = require('./src/puppets');
async function run() {
try {
// obtain and validate parameters
const parameters = await tools.getParameters();
core.debug(`Parameters: ${JSON.stringify(parameters)}`);
const parametersValid = await tools.validateParameters(parameters);
core.debug(`Parameters valid: ${parametersValid}`);
// run the action logic and return the results
const scriptResult = await puppetRun(parameters);
core.setOutput('scriptResult', scriptResult);
// XXX TODO: there are some problem reading action output in when run in a workflow (not as local unit test)
// this is a workaround for the test to be able to run both locally and on GitHub runner
core.info('--action-result::' + JSON.stringify(scriptResult));
core.info('Webpage Screenshot Action finished.');
} catch (error) {
core.error(error.message);
core.setFailed(error.message);
core.info('Webpage Screenshot Action failed.');
// exit
process.exit(1);
}
}
run();