-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add debug logging to github hook
- Loading branch information
Showing
5 changed files
with
22 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
//! Github Webhook events are sent here | ||
use axum::{extract::State, http::HeaderMap}; | ||
use tracing::{error, info}; | ||
use tracing::{debug, error, info}; | ||
|
||
use crate::AppState; | ||
|
||
|
||
pub async fn github_hook_handler(State(state): State<AppState>, headers: HeaderMap) { | ||
let event_type = headers.get("x-github-event").unwrap().to_str().unwrap(); | ||
if event_type == "push" { | ||
info!("New changes pushed to Github, pulling changes..."); | ||
match state.git.pull() { | ||
Ok(_) => { | ||
}, | ||
Err(e) => { | ||
error!("Failed to auto-pull changes with error: {e:?}"); | ||
}, | ||
debug!("Received Github webhook event of type {event_type:?}"); | ||
if event_type == "push" { | ||
info!("New changes pushed to Github, pulling changes..."); | ||
match state.git.pull() { | ||
Ok(_) => {} | ||
Err(e) => { | ||
error!("Failed to auto-pull changes with error: {e:?}"); | ||
} | ||
|
||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters