From 0280874154a20e281e4790faa82862665b73c998 Mon Sep 17 00:00:00 2001 From: Nick Cipollo Date: Tue, 27 Aug 2019 09:40:03 -0400 Subject: [PATCH] Update main --- src/Main.ts | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Main.ts b/src/Main.ts index d2013ce..857e881 100644 --- a/src/Main.ts +++ b/src/Main.ts @@ -1,25 +1,25 @@ import * as github from '@actions/github'; import * as core from '@actions/core'; -import { Inputs, CoreInputs } from './Inputs'; -import { Releases, GithubReleases } from './Releases'; +import { CoreInputs } from './Inputs'; +import { GithubReleases } from './Releases'; +import { Action } from './Action'; async function run() { try { - const token = core.getInput('token'); - const context = github.context - const git = new github.GitHub(token); - const releases = new GithubReleases(context, git) - const inputs = new CoreInputs(context) - await releases.create(inputs.tag) - .catch(error => { - core.warning(error) - }) - .then(response => { - core.warning(`response: ${response}`) - }) + const action = createAction() + await action.perform() } catch (error) { core.setFailed(error.message); } } +function createAction(): Action { + const token = core.getInput('token') + const context = github.context + const git = new github.GitHub(token) + const releases = new GithubReleases(context, git) + const inputs = new CoreInputs(context) + return new Action(inputs, releases) +} + run();