Skip to content

Commit

Permalink
✨ Add v1
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Nov 24, 2020
1 parent 5da70b0 commit 8315c2a
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
import { getInput, debug, setFailed, setOutput } from "@actions/core";
import { getOctokit } from "@actions/github";
import { getInput, setFailed } from "@actions/core";

const token =
getInput("token") || process.env.GH_PAT || process.env.GITHUB_TOKEN;
const token = getInput("token") || process.env.GH_PAT || process.env.GITHUB_TOKEN;

export const run = async () => {
if (!token) throw new Error("GitHub token not found");
const octokit = getOctokit(token);

const ms: string = getInput("milliseconds");
debug(`Waiting ${ms} milliseconds ...`);

debug(new Date().toTimeString());
await wait(parseInt(ms, 10));
debug(new Date().toTimeString());

setOutput("time", new Date().toTimeString());
};

export const wait = (milliseconds: number) => {
return new Promise<void>((resolve) => setTimeout(() => resolve(), milliseconds));
console.log("OK");
};

run()
Expand Down

0 comments on commit 8315c2a

Please sign in to comment.