fix: drop require

This commit is contained in:
Federico Grandi
2021-05-06 10:28:43 +02:00
parent 724766a764
commit 245f959e32
4 changed files with 42 additions and 18 deletions

View File

@@ -16,6 +16,7 @@ import {
matchGitArgs,
outputs,
parseBool,
readJSON,
setOutput
} from './util'
@@ -187,8 +188,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)