Add support for pipeline events
This commit is contained in:
@ -22,7 +22,7 @@ use matrix_sdk::{
|
||||
};
|
||||
use warp::Filter;
|
||||
|
||||
use crate::event::MergeRequestAction;
|
||||
use crate::event::{MergeRequestAction, PipelineStatus};
|
||||
|
||||
async fn build_sync_settings(matrix_client: &Client) -> SyncSettings {
|
||||
let mut settings = SyncSettings::default().timeout(Duration::from_secs(30));
|
||||
@ -131,6 +131,10 @@ async fn handle_gitlab_event(
|
||||
if object_attributes.action == MergeRequestAction::Other {
|
||||
return Ok(());
|
||||
}
|
||||
} else if let GitlabEvent::Pipeline { object_attributes, .. } = &event {
|
||||
if object_attributes.status == PipelineStatus::Other {
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
|
||||
let room = ensure_matrix_room_joined(matrix_client, room_id).await?;
|
||||
@ -168,7 +172,7 @@ async fn run() -> anyhow::Result<()> {
|
||||
|
||||
async move {
|
||||
let project = event.project();
|
||||
let config_key = project.homepage.replace("http://", "").replace("https://", "");
|
||||
let config_key = project.web_url.replace("http://", "").replace("https://", "");
|
||||
if let Some(repo_config) = config.repo_configs.get(&config_key) {
|
||||
if !constant_time_eq(token.as_bytes(), repo_config.token.as_bytes()) {
|
||||
warn!("Invalid token for repo '{}'", config_key);
|
||||
|
Reference in New Issue
Block a user