generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #219 Add argument to allow only updating drafts and prereleases
- Loading branch information
Showing
4 changed files
with
30 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import {Inputs} from "./Inputs"; | ||
import {ReleaseByTagResponse} from "./Releases"; | ||
|
||
export class ReleaseValidator { | ||
constructor(private inputs: Inputs) { | ||
} | ||
|
||
validateReleaseUpdate(releaseResponse: ReleaseByTagResponse) { | ||
if (!this.inputs.updateOnlyUnreleased) { | ||
return | ||
} | ||
|
||
if (!releaseResponse.data.draft && !releaseResponse.data.prerelease) { | ||
throw new Error("Tried to update ${releaseResponse.data.name} which is neither a draft or prerelease. (updateOnlyUnreleased is on)") | ||
} | ||
} | ||
} |