Fixes #267 Add ActionSkipper
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import * as core from '@actions/core';
|
||||
import {Inputs} from "./Inputs";
|
||||
import {
|
||||
CreateOrUpdateReleaseResponse,
|
||||
@@ -11,6 +12,7 @@ import {GithubError} from "./GithubError";
|
||||
import {Outputs} from "./Outputs";
|
||||
import {ArtifactDestroyer} from "./ArtifactDestroyer";
|
||||
import {ReleaseValidator} from "./ReleaseValidator";
|
||||
import {ActionSkipper} from "./ActionSkipper";
|
||||
|
||||
export class Action {
|
||||
private inputs: Inputs
|
||||
@@ -18,6 +20,7 @@ export class Action {
|
||||
private releases: Releases
|
||||
private uploader: ArtifactUploader
|
||||
private artifactDestroyer: ArtifactDestroyer
|
||||
private skipper: ActionSkipper
|
||||
|
||||
private releaseValidator: ReleaseValidator
|
||||
|
||||
@@ -25,16 +28,23 @@ export class Action {
|
||||
outputs: Outputs,
|
||||
releases: Releases,
|
||||
uploader: ArtifactUploader,
|
||||
artifactDestroyer: ArtifactDestroyer) {
|
||||
artifactDestroyer: ArtifactDestroyer,
|
||||
skipper: ActionSkipper) {
|
||||
this.inputs = inputs
|
||||
this.outputs = outputs
|
||||
this.releases = releases
|
||||
this.uploader = uploader
|
||||
this.artifactDestroyer = artifactDestroyer
|
||||
this.skipper = skipper
|
||||
this.releaseValidator = new ReleaseValidator(inputs.updateOnlyUnreleased)
|
||||
}
|
||||
|
||||
async perform() {
|
||||
if (await this.skipper.shouldSkip()) {
|
||||
core.notice("Skipping action, release already exists and skipIfReleaseExists is enabled.")
|
||||
return
|
||||
}
|
||||
|
||||
const releaseResponse = await this.createOrUpdateRelease();
|
||||
const releaseData = releaseResponse.data
|
||||
const releaseId = releaseData.id
|
||||
|
||||
Reference in New Issue
Block a user