chore: use getBooleanInput

This commit is contained in:
Fernandez Ludovic 2024-05-04 17:48:42 +02:00
parent dbb7ebcd4c
commit dbe4fc23f1
4 changed files with 15 additions and 29 deletions

14
dist/post_run/index.js generated vendored
View File

@ -88844,7 +88844,7 @@ async function buildCacheKeys() {
return keys; return keys;
} }
async function restoreCache() { async function restoreCache() {
if (core.getInput(`skip-cache`, { required: true }).trim() == "true") if (core.getBooleanInput(`skip-cache`, { required: true }))
return; return;
if (!utils.isValidEvent()) { if (!utils.isValidEvent()) {
utils.logWarning(`Event Validation Error: The event type ${process.env[constants_1.Events.Key]} is not supported because it's not tied to a branch or tag ref.`); utils.logWarning(`Event Validation Error: The event type ${process.env[constants_1.Events.Key]} is not supported because it's not tied to a branch or tag ref.`);
@ -88882,9 +88882,9 @@ async function restoreCache() {
} }
exports.restoreCache = restoreCache; exports.restoreCache = restoreCache;
async function saveCache() { async function saveCache() {
if (core.getInput(`skip-cache`, { required: true }).trim() == "true") if (core.getBooleanInput(`skip-cache`, { required: true }))
return; return;
if (core.getInput(`skip-save-cache`, { required: true }).trim() == "true") if (core.getBooleanInput(`skip-save-cache`, { required: true }))
return; return;
// Validate inputs, this can cause task failure // Validate inputs, this can cause task failure
if (!utils.isValidEvent()) { if (!utils.isValidEvent()) {
@ -89150,11 +89150,7 @@ const execShellCommand = (0, util_1.promisify)(child_process_1.exec);
const writeFile = (0, util_1.promisify)(fs.writeFile); const writeFile = (0, util_1.promisify)(fs.writeFile);
const createTempDir = (0, util_1.promisify)(tmp_1.dir); const createTempDir = (0, util_1.promisify)(tmp_1.dir);
function isOnlyNewIssues() { function isOnlyNewIssues() {
const onlyNewIssues = core.getInput(`only-new-issues`, { required: true }).trim(); return core.getBooleanInput(`only-new-issues`, { required: true });
if (onlyNewIssues !== `false` && onlyNewIssues !== `true`) {
throw new Error(`invalid value of "only-new-issues": "${onlyNewIssues}", expected "true" or "false"`);
}
return onlyNewIssues === `true`;
} }
async function prepareLint() { async function prepareLint() {
const mode = core.getInput("install-mode").toLowerCase(); const mode = core.getInput("install-mode").toLowerCase();
@ -89289,7 +89285,7 @@ async function runLint(lintPath, patchPath) {
.map(([key, value]) => [key.toLowerCase(), value ?? ""]); .map(([key, value]) => [key.toLowerCase(), value ?? ""]);
const userArgsMap = new Map(userArgsList); const userArgsMap = new Map(userArgsList);
const userArgNames = new Set(userArgsList.map(([key]) => key)); const userArgNames = new Set(userArgsList.map(([key]) => key));
const annotations = core.getInput(`annotations`).trim() !== "false"; const annotations = core.getBooleanInput(`annotations`);
if (annotations) { if (annotations) {
const formats = (userArgsMap.get("out-format") || "") const formats = (userArgsMap.get("out-format") || "")
.trim() .trim()

14
dist/run/index.js generated vendored
View File

@ -88844,7 +88844,7 @@ async function buildCacheKeys() {
return keys; return keys;
} }
async function restoreCache() { async function restoreCache() {
if (core.getInput(`skip-cache`, { required: true }).trim() == "true") if (core.getBooleanInput(`skip-cache`, { required: true }))
return; return;
if (!utils.isValidEvent()) { if (!utils.isValidEvent()) {
utils.logWarning(`Event Validation Error: The event type ${process.env[constants_1.Events.Key]} is not supported because it's not tied to a branch or tag ref.`); utils.logWarning(`Event Validation Error: The event type ${process.env[constants_1.Events.Key]} is not supported because it's not tied to a branch or tag ref.`);
@ -88882,9 +88882,9 @@ async function restoreCache() {
} }
exports.restoreCache = restoreCache; exports.restoreCache = restoreCache;
async function saveCache() { async function saveCache() {
if (core.getInput(`skip-cache`, { required: true }).trim() == "true") if (core.getBooleanInput(`skip-cache`, { required: true }))
return; return;
if (core.getInput(`skip-save-cache`, { required: true }).trim() == "true") if (core.getBooleanInput(`skip-save-cache`, { required: true }))
return; return;
// Validate inputs, this can cause task failure // Validate inputs, this can cause task failure
if (!utils.isValidEvent()) { if (!utils.isValidEvent()) {
@ -89150,11 +89150,7 @@ const execShellCommand = (0, util_1.promisify)(child_process_1.exec);
const writeFile = (0, util_1.promisify)(fs.writeFile); const writeFile = (0, util_1.promisify)(fs.writeFile);
const createTempDir = (0, util_1.promisify)(tmp_1.dir); const createTempDir = (0, util_1.promisify)(tmp_1.dir);
function isOnlyNewIssues() { function isOnlyNewIssues() {
const onlyNewIssues = core.getInput(`only-new-issues`, { required: true }).trim(); return core.getBooleanInput(`only-new-issues`, { required: true });
if (onlyNewIssues !== `false` && onlyNewIssues !== `true`) {
throw new Error(`invalid value of "only-new-issues": "${onlyNewIssues}", expected "true" or "false"`);
}
return onlyNewIssues === `true`;
} }
async function prepareLint() { async function prepareLint() {
const mode = core.getInput("install-mode").toLowerCase(); const mode = core.getInput("install-mode").toLowerCase();
@ -89289,7 +89285,7 @@ async function runLint(lintPath, patchPath) {
.map(([key, value]) => [key.toLowerCase(), value ?? ""]); .map(([key, value]) => [key.toLowerCase(), value ?? ""]);
const userArgsMap = new Map(userArgsList); const userArgsMap = new Map(userArgsList);
const userArgNames = new Set(userArgsList.map(([key]) => key)); const userArgNames = new Set(userArgsList.map(([key]) => key));
const annotations = core.getInput(`annotations`).trim() !== "false"; const annotations = core.getBooleanInput(`annotations`);
if (annotations) { if (annotations) {
const formats = (userArgsMap.get("out-format") || "") const formats = (userArgsMap.get("out-format") || "")
.trim() .trim()

View File

@ -65,7 +65,7 @@ async function buildCacheKeys(): Promise<string[]> {
} }
export async function restoreCache(): Promise<void> { export async function restoreCache(): Promise<void> {
if (core.getInput(`skip-cache`, { required: true }).trim() == "true") return if (core.getBooleanInput(`skip-cache`, { required: true })) return
if (!utils.isValidEvent()) { if (!utils.isValidEvent()) {
utils.logWarning( utils.logWarning(
@ -107,8 +107,8 @@ export async function restoreCache(): Promise<void> {
} }
export async function saveCache(): Promise<void> { export async function saveCache(): Promise<void> {
if (core.getInput(`skip-cache`, { required: true }).trim() == "true") return if (core.getBooleanInput(`skip-cache`, { required: true })) return
if (core.getInput(`skip-save-cache`, { required: true }).trim() == "true") return if (core.getBooleanInput(`skip-save-cache`, { required: true })) return
// Validate inputs, this can cause task failure // Validate inputs, this can cause task failure
if (!utils.isValidEvent()) { if (!utils.isValidEvent()) {

View File

@ -17,13 +17,7 @@ const writeFile = promisify(fs.writeFile)
const createTempDir = promisify(dir) const createTempDir = promisify(dir)
function isOnlyNewIssues(): boolean { function isOnlyNewIssues(): boolean {
const onlyNewIssues = core.getInput(`only-new-issues`, { required: true }).trim() return core.getBooleanInput(`only-new-issues`, { required: true })
if (onlyNewIssues !== `false` && onlyNewIssues !== `true`) {
throw new Error(`invalid value of "only-new-issues": "${onlyNewIssues}", expected "true" or "false"`)
}
return onlyNewIssues === `true`
} }
async function prepareLint(): Promise<string> { async function prepareLint(): Promise<string> {
@ -191,7 +185,7 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
const userArgsMap = new Map<string, string>(userArgsList) const userArgsMap = new Map<string, string>(userArgsList)
const userArgNames = new Set<string>(userArgsList.map(([key]) => key)) const userArgNames = new Set<string>(userArgsList.map(([key]) => key))
const annotations = core.getInput(`annotations`).trim() !== "false" const annotations = core.getBooleanInput(`annotations`)
if (annotations) { if (annotations) {
const formats = (userArgsMap.get("out-format") || "") const formats = (userArgsMap.get("out-format") || "")