mirror of
https://github.com/darksaid98/auto-changelog.git
synced 2026-12-02 22:16:06 +00:00
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:
1 parent
c72a270e90
commit
ea01804ccf
12 files changed
+374
-77
No files matched your search
@@ -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 });
|
||||
}
|
||||
Reference in new issue
Block a user