Skip to content

Commit

Permalink
feat: remove merge after build feature
Browse files Browse the repository at this point in the history
  • Loading branch information
eatradish committed Jul 23, 2024
1 parent e07cc0d commit e106ad6
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions server/src/routes/webhook.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use anyhow::{anyhow, bail};
use axum::{extract::State, Json};
use hyper::HeaderMap;
use octocrab::models::pulls::PullRequest;
use reqwest::StatusCode;
use serde::Deserialize;
use serde_json::Value;
Expand All @@ -17,12 +16,6 @@ pub struct WebhookComment {
comment: Comment,
}

#[derive(Debug, Deserialize)]
pub struct WebhookPullRequest {
action: String,
pr: PullRequest,
}

#[derive(Debug, Deserialize)]
struct Comment {
issue_url: String,
Expand Down Expand Up @@ -56,19 +49,6 @@ pub async fn webhook_handler(
});
}
}
Some("pull_request") => {
let webhook_pr: WebhookPullRequest = serde_json::from_value(json)?;
let pool = state.pool;

if webhook_pr.action == "closed" {
tokio::spawn(async move {
let res = handle_merged_pr(&webhook_pr.pr, pool).await;
if let Err(err) = res {
warn!("Failed to handle webhook pr: {}", err);
}
});
}
}
x => {
warn!("Unsupported Github event: {:?}", x);
}
Expand All @@ -77,16 +57,6 @@ pub async fn webhook_handler(
Ok(())
}

async fn handle_merged_pr(pr: &PullRequest, pool: DbPool) -> anyhow::Result<()> {
if pr.merged_at.is_none() {
return Ok(());
}

pipeline_new_pr_impl(pool, pr.number, None).await?;

Ok(())
}

async fn handle_webhook_comment(comment: &Comment, pool: DbPool) -> anyhow::Result<()> {
let is_org_user = is_org_user(&comment.user.login).await?;

Expand Down

0 comments on commit e106ad6

Please sign in to comment.