"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getGithubActionsInfo = void 0; const texts_1 = require("../texts"); const utils_1 = require("./utils"); function getGithubActionsInfo(readFileSync, logger) { let event; try { const rawEvent = readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8'); event = JSON.parse(rawEvent); if (event && event.pull_request) { return { commitSHA: event.pull_request.head.sha, author: event.pull_request.user.login, branchName: event.pull_request.head.ref }; } } catch (error) { logger.error(texts_1.createGithubInfoError(error.toString())); } return { commitSHA: utils_1.getEnvVariable('GITHUB_SHA'), author: utils_1.getEnvVariable('GITHUB_ACTOR'), branchName: utils_1.getEnvVariable('GITHUB_REF') }; } exports.getGithubActionsInfo = getGithubActionsInfo;