From e99f3f61cdcb9e4c12b8d30d50c6701dacc2b437 Mon Sep 17 00:00:00 2001 From: Armando Belardo <11140328+armandobelardo@users.noreply.github.com> Date: Mon, 17 Jun 2024 16:06:40 -0400 Subject: [PATCH] chore: have fern-bot manage repo names as case-insensitive (#1031) --- servers/fern-bot/.env | 4 +++- servers/fern-bot/.gitignore | 3 ++- .../src/functions/oas-cron/actions/updateOpenApiSpecs.ts | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/servers/fern-bot/.env b/servers/fern-bot/.env index bee1d805dc..bee2824fdb 100644 --- a/servers/fern-bot/.env +++ b/servers/fern-bot/.env @@ -1,7 +1,9 @@ # This is crazy, but it looks like you need to explicitly set the email and name of the app to commit as it. +GITHUB_APP_ID="FILL ME IN" +# Login name and ID can be retrieved from the below URL (substitute the bot name for prod): +# https://api.github.com/users/development-fern-bot%5Bbot%5D GITHUB_APP_LOGIN_NAME="FILL ME IN" GITHUB_APP_LOGIN_ID="FILL ME IN" -GITHUB_APP_ID="FILL ME IN" GITHUB_APP_PRIVATE_KEY="FILL ME IN" GITHUB_APP_CLIENT_ID="FILL ME IN" GITHUB_APP_CLIENT_SECRET="FILL ME IN" diff --git a/servers/fern-bot/.gitignore b/servers/fern-bot/.gitignore index 6e1e9aabef..6b24eaba41 100644 --- a/servers/fern-bot/.gitignore +++ b/servers/fern-bot/.gitignore @@ -9,4 +9,5 @@ jspm_packages .esbuild # local env files -.env.local \ No newline at end of file +.env.local +.env.prod \ No newline at end of file diff --git a/servers/fern-bot/src/functions/oas-cron/actions/updateOpenApiSpecs.ts b/servers/fern-bot/src/functions/oas-cron/actions/updateOpenApiSpecs.ts index fd08038cfb..98172ddc2b 100644 --- a/servers/fern-bot/src/functions/oas-cron/actions/updateOpenApiSpecs.ts +++ b/servers/fern-bot/src/functions/oas-cron/actions/updateOpenApiSpecs.ts @@ -104,7 +104,11 @@ export async function updateOpenApiSpecsInternal(env: Env): Promise { console.log("REPO_TO_RUN_ON has been specified, only running on:", env.REPO_TO_RUN_ON); } await app.eachRepository(async (installation) => { - if (env.REPO_TO_RUN_ON !== undefined && installation.repository.full_name !== env.REPO_TO_RUN_ON) { + // Github repo and org names are case insentitive, so we should compare them as both lowercase + if ( + env.REPO_TO_RUN_ON !== undefined && + installation.repository.full_name.toLowerCase() !== env.REPO_TO_RUN_ON.toLowerCase() + ) { return; } else if (env.REPO_TO_RUN_ON !== undefined) { console.log("REPO_TO_RUN_ON has been found, running logic.");