Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(fern-bot): update stale notifs to still update dev fern orgs #1636

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also check if ENVIRONMENT is not empty, or is empty "production" in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should never actually be empty, so feel decent about this
We assert it isn't in env.ts

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!,
};
}
Loading