Skip to content

Commit

Permalink
✨ Release v1 of action
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Oct 13, 2020
1 parent 27d693d commit 85af6b0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
35 changes: 19 additions & 16 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
import { getInput, debug, setFailed, setOutput } from "@actions/core";
import { getOctokit } from "@actions/github";
import { debug, getInput, setFailed } from "@actions/core";
import { generateGraphs } from "./graph";
import { generateSummary } from "./summary";
import { update } from "./update";

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("Starting Upptime");

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((resolve) => setTimeout(() => resolve(), milliseconds));
switch (getInput("command")) {
case "summary":
debug("Starting summary");
case "readme":
debug("Starting readme");
return generateSummary();
case "graph":
debug("Starting graph");
return generateGraphs();
default:
debug("Starting update");
return update();
}
};

run()
Expand Down
3 changes: 0 additions & 3 deletions src/readme.ts

This file was deleted.

0 comments on commit 85af6b0

Please sign in to comment.