File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ impl Client {
9292 sha : & ' a str ,
9393 force : bool ,
9494 }
95- let url = format ! ( "{}/git/refs/{}" , self . repository_url, branch) ;
95+ let url = format ! ( "{}/git/refs/heads/ {}" , self . repository_url, branch) ;
9696 let req = self
9797 . inner
9898 . patch ( & url)
@@ -119,7 +119,7 @@ impl Client {
119119 commit_message : & ' a str ,
120120 }
121121 let url = format ! ( "{}/merges" , self . repository_url) ;
122- let req = self . inner . patch ( & url) . json ( & MergeBranchRequest {
122+ let req = self . inner . post ( & url) . json ( & MergeBranchRequest {
123123 base : branch,
124124 head : sha,
125125 commit_message,
@@ -178,6 +178,9 @@ impl Client {
178178 let url = format ! ( "{}/commits/{}" , self . repository_url, sha) ;
179179 let req = self . inner . get ( & url) ;
180180 let response = self . send ( req) . await . context ( "cannot get commit" ) ?;
181+ if !response. status ( ) . is_success ( ) {
182+ anyhow:: bail!( "{:?} != 200 OK" , response. status( ) ) ;
183+ }
181184 response
182185 . json ( )
183186 . await
Original file line number Diff line number Diff line change @@ -36,10 +36,14 @@ pub async fn handle_github(
3636}
3737
3838async fn handle_push ( ctxt : Arc < SiteCtxt > , push : github:: Push ) -> ServerResult < github:: Response > {
39- let ci_client =
40- client:: Client :: from_ctxt ( & ctxt, "https://github.com/rust-lang-ci/rust" . to_owned ( ) ) ;
41- let main_repo_client =
42- client:: Client :: from_ctxt ( & ctxt, "https://github.com/rust-lang/rust" . to_owned ( ) ) ;
39+ let ci_client = client:: Client :: from_ctxt (
40+ & ctxt,
41+ "https://api.github.com/repos/rust-lang-ci/rust" . to_owned ( ) ,
42+ ) ;
43+ let main_repo_client = client:: Client :: from_ctxt (
44+ & ctxt,
45+ "https://api.github.com/repos/rust-lang/rust" . to_owned ( ) ,
46+ ) ;
4347 if push. r#ref != "refs/heads/master" {
4448 return Ok ( github:: Response ) ;
4549 }
You can’t perform that action at this time.
0 commit comments