mirror of
https://github.com/peaceiris/actions-hugo.git
synced 2026-01-24 10:47:28 +01:00
feat: Add JavaScript action template
https://github.com/actions/javascript-action
This commit is contained in:
22
index.js
Normal file
22
index.js
Normal file
@@ -0,0 +1,22 @@
|
||||
const core = require('@actions/core');
|
||||
const wait = require('./wait');
|
||||
|
||||
|
||||
// most @actions toolkit packages have async methods
|
||||
async function run() {
|
||||
try {
|
||||
const ms = core.getInput('milliseconds');
|
||||
console.log(`Waiting ${ms} milliseconds ...`)
|
||||
|
||||
core.debug((new Date()).toTimeString())
|
||||
wait(parseInt(ms));
|
||||
core.debug((new Date()).toTimeString())
|
||||
|
||||
core.setOutput('time', new Date().toTimeString());
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
run()
|
||||
Reference in New Issue
Block a user