1
0
mirror of synced 2025-12-30 12:02:01 -05:00

make getActionContext require process.env.GITHUB_EVENT_PATH (#32509)

This commit is contained in:
Peter Bengtsson
2022-11-10 17:56:33 +01:00
committed by GitHub
parent 1e2bd3a512
commit ba17a4eefc

View File

@@ -2,6 +2,9 @@ import { readFileSync } from 'fs'
// Parses the action event payload sets repo and owner to an object from runner environment
export function getActionContext() {
if (!process.env.GITHUB_EVENT_PATH) {
throw new Error('process.env.GITHUB_EVENT_PATH is not set')
}
const context = JSON.parse(readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8'))
if (context.repository) {
context.owner = context.repository.owner.login