Update main
This commit is contained in:
28
src/Main.ts
28
src/Main.ts
@@ -1,25 +1,25 @@
|
|||||||
import * as github from '@actions/github';
|
import * as github from '@actions/github';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import { Inputs, CoreInputs } from './Inputs';
|
import { CoreInputs } from './Inputs';
|
||||||
import { Releases, GithubReleases } from './Releases';
|
import { GithubReleases } from './Releases';
|
||||||
|
import { Action } from './Action';
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
const token = core.getInput('token');
|
const action = createAction()
|
||||||
const context = github.context
|
await action.perform()
|
||||||
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}`)
|
|
||||||
})
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
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();
|
run();
|
||||||
|
|||||||
Reference in New Issue
Block a user