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