chore(deps-dev): upgrade @vercel/ncc to 0.28.x
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
log,
|
||||
matchGitArgs,
|
||||
parseBool,
|
||||
readJSON,
|
||||
setOutput,
|
||||
tools
|
||||
} from './util'
|
||||
@@ -186,8 +187,9 @@ async function checkInputs() {
|
||||
}
|
||||
|
||||
const eventPath = process.env.GITHUB_EVENT_PATH,
|
||||
event = eventPath && require(eventPath),
|
||||
isPR = process.env.GITHUB_EVENT_NAME?.includes('pull_request'),
|
||||
event = eventPath && readJSON(eventPath)
|
||||
|
||||
const isPR = process.env.GITHUB_EVENT_NAME?.includes('pull_request'),
|
||||
defaultBranch = isPR
|
||||
? (event?.pull_request?.head?.ref as string)
|
||||
: process.env.GITHUB_REF?.substring(11)
|
||||
|
||||
16
src/util.ts
16
src/util.ts
@@ -1,6 +1,7 @@
|
||||
import { parseArgsStringToArgv } from 'string-argv'
|
||||
import * as core from '@actions/core'
|
||||
import { Toolkit } from 'actions-toolkit'
|
||||
import fs from 'fs'
|
||||
|
||||
export type Input =
|
||||
| 'add'
|
||||
@@ -98,6 +99,21 @@ export function parseBool(value: any) {
|
||||
} catch {}
|
||||
}
|
||||
|
||||
export function readJSON(filePath: string) {
|
||||
let fileContent: string
|
||||
try {
|
||||
fileContent = fs.readFileSync(filePath, { encoding: 'utf8' })
|
||||
} catch {
|
||||
throw `Couldn't read file. File path: ${filePath}`
|
||||
}
|
||||
|
||||
try {
|
||||
return JSON.parse(fileContent)
|
||||
} catch {
|
||||
throw `Couldn't parse file to JSON. File path: ${filePath}`
|
||||
}
|
||||
}
|
||||
|
||||
export function setOutput(name: Output, value: 'true' | 'false') {
|
||||
core.debug(`Setting output: ${name}=${value}`)
|
||||
tools.outputs[name] = value
|
||||
|
||||
Reference in New Issue
Block a user