diff --git a/servers/fern-bot/serverless.yml b/servers/fern-bot/serverless.yml index 1c8eda7024..0b03f0a984 100644 --- a/servers/fern-bot/serverless.yml +++ b/servers/fern-bot/serverless.yml @@ -30,6 +30,7 @@ provider: CUSTOMER_PULLS_SLACK_CHANNEL: ${env:CUSTOMER_PULLS_SLACK_CHANNEL, 'placeholder'} REPO_TO_RUN_ON: ${env:REPO_TO_RUN_ON, 'OMIT'} FERN_TOKEN: ${env:FERN_TOKEN, 'OMIT'} + ENVIRONMENT: ${opt:stage} # Roles for the lambda functions iam: diff --git a/servers/fern-bot/src/functions/stale-notifs/actions/sendStaleNotifications.ts b/servers/fern-bot/src/functions/stale-notifs/actions/sendStaleNotifications.ts index ce3fcc255a..5831e7ee51 100644 --- a/servers/fern-bot/src/functions/stale-notifs/actions/sendStaleNotifications.ts +++ b/servers/fern-bot/src/functions/stale-notifs/actions/sendStaleNotifications.ts @@ -31,7 +31,7 @@ export async function sendStaleNotificationsInternal(env: Env): Promise { const orgPullMap = new Map(); let staleBotPRsFound = false; for await (const pull of botPulls) { - if (EXCLUDE_ORGS.has(pull.repositoryOwner)) { + if (env.ENVIRONMENT !== "development" && EXCLUDE_ORGS.has(pull.repositoryOwner)) { continue; } @@ -82,7 +82,7 @@ export async function sendStaleNotificationsInternal(env: Env): Promise { // Notify on any PRs opened by us to CUSTOMER_PULLS_SLACK_CHANNEL let numStaleTeamPulls = 0; for await (const pull of teamPulls) { - if (EXCLUDE_ORGS.has(pull.repositoryOwner)) { + if (env.ENVIRONMENT !== "development" && EXCLUDE_ORGS.has(pull.repositoryOwner)) { continue; } if (pull.createdAt < new Date(Date.now() - STALE_IN_MS)) { diff --git a/servers/fern-bot/src/libs/env.ts b/servers/fern-bot/src/libs/env.ts index 0124f579d5..6dc2579ad5 100644 --- a/servers/fern-bot/src/libs/env.ts +++ b/servers/fern-bot/src/libs/env.ts @@ -19,6 +19,7 @@ export interface Env { CUSTOMER_PULLS_SLACK_CHANNEL: string; FERNIE_SLACK_APP_TOKEN: string; FERN_TOKEN: string; + ENVIRONMENT: string; } export function evaluateEnv(): Env { @@ -44,5 +45,6 @@ export function evaluateEnv(): Env { CUSTOMER_ALERTS_SLACK_CHANNEL: process?.env.CUSTOMER_ALERTS_SLACK_CHANNEL!, CUSTOMER_PULLS_SLACK_CHANNEL: process?.env.CUSTOMER_PULLS_SLACK_CHANNEL!, FERN_TOKEN: process?.env.FERN_TOKEN!, + ENVIRONMENT: process?.env.ENVIRONMENT!, }; }