Add notifications for target maintainers (#10)

This adds a feature where maintainers can add themselves to an array in the source to receive notifications whenever the target fails.

The way this works is via GitHub, I created a new repository https://github.com/Noratrieb/does-it-build-notifications where an app will create issues that ping the respective users. This is the easiest option for me and also fits nicely into people's workflows on GitHub.

Whenever a target fails, an issue is created for it. This issue is kept open (with a new comment every day that it continues to fail), and then closed when the target builds again.
This commit is contained in:
nora 2025-11-10 20:52:15 +01:00 committed by GitHub
parent 112420d224
commit e4c69f17be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 784 additions and 13 deletions

View file

@ -1,6 +1,7 @@
mod build;
mod db;
mod nightlies;
mod notification;
mod web;
use color_eyre::{eyre::WrapErr, Result};
@ -12,6 +13,10 @@ const VERSION_SHORT: &str = env!("GIT_COMMIT_SHORT");
#[tokio::main]
async fn main() -> Result<()> {
main_inner().await
}
async fn main_inner() -> Result<()> {
tracing_subscriber::fmt()
.with_env_filter(EnvFilter::try_from_default_env().unwrap_or(EnvFilter::new("info")))
.init();
@ -22,7 +27,33 @@ async fn main() -> Result<()> {
.await
.wrap_err("running migrations")?;
let builder = build::background_builder(db.clone());
let send_pings = std::env::var("GITHUB_SEND_PINGS")
.map(|_| true)
.unwrap_or(false);
let github_owner = std::env::var("GITHUB_OWNER").wrap_err("missing GITHUB_OWNER env var")?;
let github_repo = std::env::var("GITHUB_REPO").wrap_err("missing GITHUB_REPO env var")?;
let app_id = std::env::var("GITHUB_APP_ID")
.wrap_err("missing GITHUB_APP_ID env var")?
.parse::<u64>()
.wrap_err("invalid GITHUB_APP_ID")?;
let key = std::env::var("GITHUB_APP_PRIVATE_KEY")
.wrap_err("missing GITHUB_APP_PRIVATE_KEY env var")?;
let key = jsonwebtoken::EncodingKey::from_rsa_pem(key.as_bytes()).unwrap();
let github_client = octocrab::Octocrab::builder()
.app(app_id.into(), key)
.build()
.wrap_err("failed to create client")?;
let github_client = notification::GitHubClient::new(
send_pings,
github_client,
github_owner.clone(),
github_repo.clone(),
)
.await?;
let builder = build::background_builder(db.clone(), github_client);
let server = web::webserver(db);
tokio::select! {