Skip to content
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
20 changes: 12 additions & 8 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -155,19 +155,23 @@ GITHUB_ANNOUNCE_CHANNEL_ID=
# Channel for pull request announcements
# Receives:
# - New PR created
# - PR updated (title, description)
# - PR status changes
# - New PR announcements from prPoller
#
# Note: PR assignee changes and PR status updates are NOT announced
# (filtered out to reduce noise - only Issues trigger these notifications)
#
# If unset, falls back to GITHUB_ANNOUNCE_CHANNEL_ID
GITHUB_PR_ANNOUNCE_CHANNEL_ID=

# Channel for assignee and closure activity
# Channel for Issue activity (assignees and closures)
# Receives:
# - Assignee added to issue/PR
# - Assignee removed from issue/PR
# - Self-assignment notifications
# - Issue closed
# - PR closed/merged
# - Assignee added to ISSUE (not PRs)
# - Assignee removed from ISSUE (not PRs)
# - Self-assignment notifications for ISSUES
# - ISSUE closed
#
# Note: PR assignee changes and closures are NOT announced here
# (filtered out to reduce noise)
#
# If unset, falls back to GITHUB_ANNOUNCE_CHANNEL_ID
# If neither is set, assignee polling is disabled
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ OmegaBot uses discord.js v14 which includes:
├── .env
├── .env.example
├── eslint.config.ts
├── fix-pr-noise-simple.sh
├── .github
│ ├── ISSUE_TEMPLATE
│ │ ├── bug.yml
Expand Down Expand Up @@ -283,7 +284,6 @@ OmegaBot uses discord.js v14 which includes:
│ │ │ ├── guildConfigStore.ts
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ ├── database
│ │ ├── discord
│ │ │ ├── commandLoader.ts
│ │ │ ├── commandMeta.ts
Expand All @@ -310,6 +310,7 @@ OmegaBot uses discord.js v14 which includes:
│ │ │ ├── githubClient.ts
│ │ │ ├── githubErrorMessage.ts
│ │ │ ├── issueAssigneePoller.ts
│ │ │ ├── issueAssigneePoller.ts.backup
│ │ │ ├── lastSeenStore.ts
│ │ │ ├── prFormatter.ts
│ │ │ ├── prPoller.ts
Expand Down
79 changes: 79 additions & 0 deletions fix-pr-noise-simple.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash

set -e

echo "🔇 Fixing PR Notification Noise"
echo "================================"
echo ""

GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'

print_success() { echo -e "${GREEN}✓${NC} $1"; }
print_error() { echo -e "${RED}✗${NC} $1"; }

FILE="src/services/github/issueAssigneePoller.ts"

if [ ! -f "$FILE" ]; then
print_error "$FILE not found"
exit 1
fi

echo "Backing up..."
cp "$FILE" "$FILE.backup"
print_success "Created backup"

echo ""
echo "Applying fixes..."

# Fix 1: Filter assignee notifications to Issues only
perl -i -pe 's/for \(const n of notifications\) \{/const issueNotifications = notifications.filter(n => n.kind === "Issue");\n\n for (const n of issueNotifications) {/' "$FILE"

# Fix 2: Simplify message (remove **Kind** since it's always Issue)
perl -i -pe 's/parts\.push\(`\*\*\$\{n\.kind\} #\$\{n\.number\}\*\* assignees updated`\);/parts.push(`Issue #${n.number} assignees updated`);/' "$FILE"

# Fix 3: Filter closed notifications to Issues only
perl -i -pe 's/for \(const c of closedNotifications\) \{/const closedIssues = closedNotifications.filter(c => c.kind === "Issue");\n\n for (const c of closedIssues) {/' "$FILE"

# Fix 4: Simplify closed message
perl -i -pe 's/parts\.push\(`\*\*\$\{c\.kind\} #\$\{c\.number\}\*\* is no longer open`\);/parts.push(`Issue #${c.number} closed`);/' "$FILE"

print_success "Fixes applied"

echo ""
echo "Building..."
npm run build

if [ $? -eq 0 ]; then
echo ""
echo "╔════════════════════════════════════════════════════╗"
echo "║ ✅ Fixed! Build Successful! ║"
echo "╚════════════════════════════════════════════════════╝"
echo ""
echo "Changes:"
echo " ✅ Only Issues trigger notifications (no PR noise)"
echo " ✅ Cleaner message format"
echo ""
echo "What gets announced now:"
echo " ✅ Issue #60 assignees updated"
echo " ✅ Issue #60 closed"
echo ""
echo "What is now silent:"
echo " 🔇 PR assignee changes"
echo " 🔇 PR merges/closes"
echo ""
echo "Restart your bot:"
echo " npm start"
echo ""
echo "To rollback:"
echo " cp $FILE.backup $FILE"
echo " npm run build"
echo ""
else
echo ""
print_error "Build failed"
echo "Restoring backup..."
cp "$FILE.backup" "$FILE"
exit 1
fi
12 changes: 8 additions & 4 deletions src/services/github/issueAssigneePoller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,11 @@ export async function pollIssueAssigneesOnce(args: PollArgs): Promise<void> {
}

// Announce assignee changes
for (const n of notifications) {
const issueNotifications = notifications.filter((n) => n.kind === "Issue");

for (const n of issueNotifications) {
const parts: string[] = [];
parts.push(`**${n.kind} #${n.number}** assignees updated`);
parts.push(`Issue # assignees updated`);
parts.push(n.title);
parts.push(n.url);

Expand All @@ -307,9 +309,11 @@ export async function pollIssueAssigneesOnce(args: PollArgs): Promise<void> {
}

// Announce closures (issues + PRs)
for (const c of closedNotifications) {
const closedIssues = closedNotifications.filter((c) => c.kind === "Issue");

for (const c of closedIssues) {
const parts: string[] = [];
parts.push(`**${c.kind} #${c.number}** is no longer open`);
parts.push(`Issue # closed`);
parts.push(c.title);
parts.push(c.url);
parts.push("(Closed/merged/etc — detected via polling)");
Expand Down
Loading