feat: Add commit-types & default-commit-type inputs (#15)

* deps: Add `yaml` version `1.10.2`

* deps: Add `joi` version `17.6.0`

* feat: Add `commit-types` & `default-commit-type` inputs

* ci: Update `Test` workflow

* chore: Update `README.md`
This commit is contained in:
Ardalan Amini authored and GitHub committed 2022-03-04 14:17:53 +03:30
1 parent c72a270e90
commit ea01804ccf
12 files changed
+374 -77

No files matched your search

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