feat: Add semantic versioning compatibility (#47)

* feat: Use regex groups

* feat: Add semver input

* deps: Add semver v7.3.7

* deps(Dev): Add @types/semver v7.3.9

* feat: Add prerelease output

* chore: Update action directory

* feat: Log prerelease value

* ci(GitHub): Update release workflow

* docs: Update README.md

* feat: Add ability to detect previous version based on semver comparison

* ci(GitHub): fix test workflow
This commit is contained in:
Ardalan Amini authored and GitHub committed 2022-04-29 00:06:26 +04:30
1 parent de993f2bea
commit bd78d66436
16 files changed
+226 -53

No files matched your search

+4 -2
View File
@@ -1,4 +1,4 @@
import { getInput } from "@actions/core";
import { getInput, getBooleanInput } from "@actions/core";
import Joi from "joi";
import YAML from "yaml";
import { ActionInputsI, TypesI } from "./constants";
@@ -10,6 +10,7 @@ export function getToken(): string {
export async function getInputs(): Promise<ActionInputsI> {
const commitTypes = YAML.parse(getInput("commit-types", { required: true }));
const defaultCommitType = getInput("default-commit-type", { required: true });
const semver = getBooleanInput("semver", { required: true });
return Joi.object<ActionInputsI, true>()
.keys({
@@ -17,6 +18,7 @@ export async function getInputs(): Promise<ActionInputsI> {
.pattern(Joi.string(), Joi.string())
.required(),
defaultCommitType: Joi.string().required(),
semver: Joi.boolean().required(),
})
.validateAsync({ commitTypes, defaultCommitType });
.validateAsync({ commitTypes, defaultCommitType, semver });
}