Skip to content

Commit

Permalink
chore: use getBooleanInput
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed May 4, 2024
1 parent dbb7ebc commit dbe4fc2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 29 deletions.
14 changes: 5 additions & 9 deletions dist/post_run/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 5 additions & 9 deletions dist/run/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/cache.ts
Expand Up @@ -65,7 +65,7 @@ async function buildCacheKeys(): Promise<string[]> {
}

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()) {
utils.logWarning(
Expand Down Expand Up @@ -107,8 +107,8 @@ export async function restoreCache(): Promise<void> {
}

export async function saveCache(): Promise<void> {
if (core.getInput(`skip-cache`, { required: true }).trim() == "true") return
if (core.getInput(`skip-save-cache`, { required: true }).trim() == "true") return
if (core.getBooleanInput(`skip-cache`, { required: true })) return
if (core.getBooleanInput(`skip-save-cache`, { required: true })) return

// Validate inputs, this can cause task failure
if (!utils.isValidEvent()) {
Expand Down
10 changes: 2 additions & 8 deletions src/run.ts
Expand Up @@ -17,13 +17,7 @@ const writeFile = promisify(fs.writeFile)
const createTempDir = promisify(dir)

function isOnlyNewIssues(): boolean {
const onlyNewIssues = core.getInput(`only-new-issues`, { required: true }).trim()

if (onlyNewIssues !== `false` && onlyNewIssues !== `true`) {
throw new Error(`invalid value of "only-new-issues": "${onlyNewIssues}", expected "true" or "false"`)
}

return onlyNewIssues === `true`
return core.getBooleanInput(`only-new-issues`, { required: true })
}

async function prepareLint(): Promise<string> {
Expand Down Expand Up @@ -191,7 +185,7 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
const userArgsMap = new Map<string, string>(userArgsList)
const userArgNames = new Set<string>(userArgsList.map(([key]) => key))

const annotations = core.getInput(`annotations`).trim() !== "false"
const annotations = core.getBooleanInput(`annotations`)

if (annotations) {
const formats = (userArgsMap.get("out-format") || "")
Expand Down

0 comments on commit dbe4fc2

Please sign in to comment.