forked from actions/hello-world-docker-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.js
More file actions
47 lines (39 loc) · 1.16 KB
/
entrypoint.js
File metadata and controls
47 lines (39 loc) · 1.16 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const util = require('util');
const exec = util.promisify(require('child_process').exec);
const core = require('@actions/core');
const github = require('@actions/github');
const run = async ()=> {
{
// Log ls -l
const { stdout, stderr } = await exec('ls -l');
console.log(stdout);
if(stderr) {
return Promise.reject(stderr);
}
}
{
// Log node version
const { stdout, stderr } = await exec('node --version');
console.log('node:', stdout);
if(stderr) {
return Promise.reject(stderr);
}
}
{
// Log npm version
const { stdout, stderr } = await exec('npm --version');
console.log('npm:', stdout);
if(stderr) {
return Promise.reject(stderr);
}
}
// `who-to-greet` input defined in action metadata file
const nameToGreet = core.getInput('who-to-greet');
console.log(`Hello ${nameToGreet}!`);
const time = (new Date()).toTimeString();
core.setOutput("time", time);
// Get the JSON webhook payload for the event that triggered the workflow
const payload = JSON.stringify(github.context.payload, undefined, 2)
console.log(`The event payload: ${payload}`);
};
run().catch(core.setFailed);