Skip to content

Commit

Permalink
chore(fern-bot): update stale notifs to still update dev fern orgs (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
armandobelardo authored Oct 10, 2024
1 parent a844a2f commit 77d1590
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions servers/fern-bot/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export async function sendStaleNotificationsInternal(env: Env): Promise<void> {
const orgPullMap = new Map<string, PullRequest[]>();
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;
}

Expand Down Expand Up @@ -82,7 +82,7 @@ export async function sendStaleNotificationsInternal(env: Env): Promise<void> {
// 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)) {
Expand Down
2 changes: 2 additions & 0 deletions servers/fern-bot/src/libs/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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!,
};
}

0 comments on commit 77d1590

Please sign in to comment.