Initial commit

This commit is contained in:
marocchino 2019-11-21 08:05:13 +09:00
commit cce71e2a2d
14 changed files with 5733 additions and 0 deletions

19
src/main.ts Normal file
View file

@ -0,0 +1,19 @@
import * as core from '@actions/core';
import {wait} from './wait'
async function run() {
try {
const ms = core.getInput('milliseconds');
console.log(`Waiting ${ms} milliseconds ...`)
core.debug((new Date()).toTimeString())
await wait(parseInt(ms, 10));
core.debug((new Date()).toTimeString())
core.setOutput('time', new Date().toTimeString());
} catch (error) {
core.setFailed(error.message);
}
}
run();

10
src/wait.ts Normal file
View file

@ -0,0 +1,10 @@
export function wait(milliseconds: number) {
return new Promise((resolve) => {
if (isNaN(milliseconds)) {
throw new Error('milleseconds not a number');
}
setTimeout(() => resolve("done!"), milliseconds)
});
}