Fixed types

This commit is contained in:
Tonye Jack 2023-05-23 00:44:13 -06:00
parent 90ac7a910d
commit b494efc466

View File

@ -14,9 +14,28 @@ export type Env = {
GITHUB_EVENT_PULL_REQUEST_BASE_SHA: string GITHUB_EVENT_PULL_REQUEST_BASE_SHA: string
} }
type GithubEvent = {
forced?: string
pull_request?: {
head: {
ref: string
}
base: {
ref: string
sha: string
}
number: string
}
before?: string
base_ref?: string
head_repo?: {
fork: string
}
}
export const getEnv = async (): Promise<Env> => { export const getEnv = async (): Promise<Env> => {
const eventPath = process.env.GITHUB_EVENT_PATH const eventPath = process.env.GITHUB_EVENT_PATH
let eventJson: any = {} let eventJson: GithubEvent = {}
if (eventPath) { if (eventPath) {
eventJson = JSON.parse(await fs.readFile(eventPath, {encoding: 'utf8'})) eventJson = JSON.parse(await fs.readFile(eventPath, {encoding: 'utf8'}))