TJ-Bot
TJ-Bot copied to clipboard
PR notifications
About
closes #1142
Implements the functionality for PR notifications
link-gh-project: links a channel to GitHub repositories to announce new pull request
unlink-gh-project: unlinks a previous pull request notification configuration
The PullRequestNotificationRoutine handles pulling the new updates from repositories and sending a notification.
Database
This PR creates a new database table to store the notification configuration:
CREATE TABLE pr_notifications
(
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
channel_id BIGINT NOT NULL,
repository_owner TEXT NOT NULL,
repository_name TEXT NOT NULL
)
Closing this PR. GitHub already supports native Discord webhook notifications through the GitHub repo settings, which makes this kinda redundant. The feature also isn't critical and likely wouldn't be used much in practice (probably).
The webhook alternative approach involves sharing the sensitive webhook link with a third party. My suggestion would be sharing them with very active #projects posts and trusted users if needed. If anything goes wrong, we can just disable the webhook.
Quick note:
When sharing webhook links in forum-based threads, you need to append a thread_id query parameter to the webhook link: https://discord.com/developers/docs/resources/webhook#execute-webhook
