11use std:: path:: Path ;
2+ use serde_derive:: Deserialize ;
23use actix_web:: { post, App , HttpResponse , HttpServer , Responder ,
34 web, rt, middleware:: Logger } ;
45use awc:: Client ;
@@ -10,17 +11,24 @@ mod cleanup;
1011mod config;
1112mod args;
1213
14+ #[ derive( Deserialize ) ]
15+ struct PreviewParams {
16+ job : String ,
17+ }
18+
1319/// Handler of the HTTP server /preview/ endpoint.
1420///
1521/// This gets the parameters from the url and adds a job to the queue
1622/// to be processed by the worker.
1723#[ post( "/preview/{github_owner}/{github_repo}/{pull_request_number}/" ) ]
1824async fn preview_handler ( params : web:: Path < ( String , String , u64 ) > ,
25+ query_params : web:: Query < PreviewParams > ,
1926 client : web:: Data < Client > ,
2027 settings : web:: Data < config:: SettingsPerThread > ) -> impl Responder {
2128 let github_owner = & params. 0 ;
2229 let github_repo = & params. 1 ;
2330 let pull_request_number = params. 2 ;
31+ let job_name = & query_params. job ;
2432
2533 if !settings. github_allowed_owners . is_empty ( )
2634 && !settings. github_allowed_owners . contains ( github_owner) {
@@ -51,6 +59,7 @@ async fn preview_handler(params: web::Path<(String, String, u64)>,
5159 match github:: publish_artifact ( & client,
5260 & base_api_url,
5361 pull_request_number,
62+ job_name,
5463 & target_dir,
5564 settings. max_artifact_size ) . await {
5665 Ok ( _) => {
0 commit comments