diff --git a/VKUI/patch/src/getBooleanInput.ts b/VKUI/patch/src/getBooleanInput.ts new file mode 100644 index 0000000..ab12051 --- /dev/null +++ b/VKUI/patch/src/getBooleanInput.ts @@ -0,0 +1,22 @@ +import * as core from '@actions/core'; + +const trueValue = ['true', 'True', 'TRUE']; +const falseValue = ['false', 'False', 'FALSE']; + +/** + * Исправленная версия getBooleanInput функции из `@actions/core`. + * + * [getBooleanInput ignores options.required](https://github.com/actions/toolkit/issues/844) + */ +export function getBooleanInput(name: string, options?: core.InputOptions): boolean { + const val = core.getInput(name, options); + + if (!val) return false; + if (trueValue.includes(val)) return true; + if (falseValue.includes(val)) return false; + + throw new TypeError( + `Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` + + `Support boolean input list: \`true | True | TRUE | false | False | FALSE\``, + ); +} diff --git a/VKUI/patch/src/main.ts b/VKUI/patch/src/main.ts index 87c0522..89e3ac2 100644 --- a/VKUI/patch/src/main.ts +++ b/VKUI/patch/src/main.ts @@ -7,6 +7,7 @@ import { SemVer } from 'semver'; import { getPatchInstructions } from './message'; import { getMergeData } from './getMergeData'; import { stableBranchName } from './stableBranchName'; +import { getBooleanInput } from './getBooleanInput'; function getPrNumber() { const pullRequest = github.context.payload.pull_request; @@ -49,7 +50,7 @@ async function run(): Promise { const token = core.getInput('token', { required: true }); const directory = core.getInput('directory'); const targetBranchInput = core.getInput('targetBranch'); - const needScreenshots = core.getBooleanInput('needScreenshots'); + const needScreenshots = getBooleanInput('needScreenshots'); const pullNumber = getPrNumber(); const gh = github.getOctokit(token);