hello-world-javascript-action/index.js

16 lines
564 B
JavaScript
Raw Permalink Normal View History

2019-08-03 21:44:52 +00:00
const core = require('@actions/core');
2019-08-07 04:35:31 +00:00
const github = require('@actions/github');
2019-08-03 21:44:52 +00:00
2019-08-07 02:24:57 +00:00
try {
2019-09-06 22:10:28 +00:00
// `who-to-greet` input defined in action metadata file
2019-08-07 02:24:57 +00:00
const nameToGreet = core.getInput('who-to-greet');
2019-08-07 04:35:31 +00:00
console.log(`Hello ${nameToGreet}!`);
const time = (new Date()).toTimeString();
core.setOutput("time", time);
2019-09-06 22:10:28 +00:00
// Get the JSON webhook payload for the event that triggered the workflow
2019-08-07 04:35:31 +00:00
const payload = JSON.stringify(github.context.payload, undefined, 2)
console.log(`The event payload: ${payload}`);
2019-08-07 02:24:57 +00:00
} catch (error) {
core.setFailed(error.message);
}