mirror of
https://github.com/marocchino/sticky-pull-request-comment.git
synced 2026-04-08 07:20:05 +00:00
Initial commit
This commit is contained in:
commit
cce71e2a2d
14 changed files with 5733 additions and 0 deletions
19
src/main.ts
Normal file
19
src/main.ts
Normal 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
10
src/wait.ts
Normal 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)
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue