From b6b31c932a517856748d3d624481b034725b28a0 Mon Sep 17 00:00:00 2001 From: Christoffer Olofsson <15955091+ChrisAcrobat@users.noreply.github.com> Date: Thu, 3 Aug 2023 20:29:01 +0200 Subject: [PATCH] Update main.ts --- src/main.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 986abf2..b3fbbf7 100644 --- a/src/main.ts +++ b/src/main.ts @@ -22,7 +22,12 @@ async function run(): Promise { const installations: listInstallationsResponse = await appOctokit.apps.listInstallations(); - let installationId = installations.data[0].id; + let installationId; + try { + installationId = installations.data[0].id; + } catch (error) { + throw new Error(`Could not get repo installation. Is the app installed on this repo?`); + } if (scope !== '') { const scopedData = installations.data.find( (item) => item.account?.login === scope