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 {
92
92
sha : & ' a str ,
93
93
force : bool ,
94
94
}
95
- let url = format ! ( "{}/git/refs/{}" , self . repository_url, branch) ;
95
+ let url = format ! ( "{}/git/refs/heads/ {}" , self . repository_url, branch) ;
96
96
let req = self
97
97
. inner
98
98
. patch ( & url)
@@ -119,7 +119,7 @@ impl Client {
119
119
commit_message : & ' a str ,
120
120
}
121
121
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 {
123
123
base : branch,
124
124
head : sha,
125
125
commit_message,
@@ -178,6 +178,9 @@ impl Client {
178
178
let url = format ! ( "{}/commits/{}" , self . repository_url, sha) ;
179
179
let req = self . inner . get ( & url) ;
180
180
let response = self . send ( req) . await . context ( "cannot get commit" ) ?;
181
+ if !response. status ( ) . is_success ( ) {
182
+ anyhow:: bail!( "{:?} != 200 OK" , response. status( ) ) ;
183
+ }
181
184
response
182
185
. json ( )
183
186
. await
Original file line number Diff line number Diff line change @@ -36,10 +36,14 @@ pub async fn handle_github(
36
36
}
37
37
38
38
async 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
+ ) ;
43
47
if push. r#ref != "refs/heads/master" {
44
48
return Ok ( github:: Response ) ;
45
49
}
You can’t perform that action at this time.
0 commit comments