From 835e0cc524620257f7fa9450f41e2eebe83051ea Mon Sep 17 00:00:00 2001 From: Aiden Fujiwara Date: Fri, 29 Sep 2023 11:15:14 -0700 Subject: [PATCH] print repo --- src/main.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main.ts b/src/main.ts index 06b9e30..9aa2674 100644 --- a/src/main.ts +++ b/src/main.ts @@ -16,14 +16,16 @@ async function run(): Promise { ).toLowerCase(); if (allowExternalGithubOrgs != "true") { - const repo = context.payload.repository; - if (repo == null) { - throw new Error(`Could not find repository`); + // const repo = new Context(); + if (!process.env.GITHUB_REPOSITORY) { + throw new Error(`Could not find repository setup-foreman is running in`); } - const org = repo.owner.name; - if (org == null) { - throw new Error(`Could not find owner of the repository. repo: ${JSON.stringify(repo)}`); + const repository = process.env.GITHUB_REPOSITORY.split('/'); + if (repository.length == 0) { + throw new Error(`Could not find owner of repository setup-foreman is running in`) } + const org = repository[0] + console.log(org); configFile.checkSameOrgInConfig(org); }