@@ -11,6 +11,7 @@ use octocrab::Octocrab;
11
11
use std:: io:: { Cursor , Read , Write } ;
12
12
use std:: os:: unix:: process:: CommandExt ;
13
13
use std:: path:: Path ;
14
+ use url:: Url ;
14
15
15
16
use rd_util:: { LambdaRequest as Request , LambdaResponse as Response } ;
16
17
@@ -19,6 +20,9 @@ use crate::job::{FormatOpts, JobCtxs};
19
20
// The hard-coded file name is safe because the lambda function runs single-threaded
20
21
// and isolated - each concurrent instance runs on its own environment.
21
22
const RESULT_PATH : & ' static str = "/tmp/result.json.gz" ;
23
+ // For testing purpose.
24
+ //const IOCOST_BUCKET: &'static str = "iocostbucket";
25
+ //const IOCOST_BUCKET_REGION: &'static str = "eu-north-1";
22
26
const IOCOST_BUCKET : & ' static str = "iocost-submit" ;
23
27
const IOCOST_BUCKET_REGION : & ' static str = "us-east-1" ;
24
28
@@ -180,22 +184,19 @@ impl LambdaHelper {
180
184
181
185
let octocrab = Octocrab :: builder ( ) . personal_token ( token) . build ( ) ?;
182
186
183
- let installations = octocrab
187
+ let installation = octocrab
184
188
. apps ( )
185
- . installations ( )
186
- . send ( )
187
- . await
188
- . unwrap ( )
189
- . take_items ( ) ;
189
+ . get_repository_installation ( "iocost-benchmark" , "iocost-benchmarks" )
190
+ . await ?;
190
191
191
192
let mut create_access_token = CreateInstallationAccessToken :: default ( ) ;
192
193
create_access_token. repositories = vec ! [ "iocost-benchmarks" . to_string( ) ] ;
193
194
195
+ let access_token_url =
196
+ Url :: parse ( installation. access_tokens_url . as_ref ( ) . unwrap ( ) ) . unwrap ( ) ;
197
+
194
198
let access: InstallationToken = octocrab
195
- . post (
196
- installations[ 0 ] . access_tokens_url . as_ref ( ) . unwrap ( ) ,
197
- Some ( & create_access_token) ,
198
- )
199
+ . post ( access_token_url. path ( ) , Some ( & create_access_token) )
199
200
. await
200
201
. unwrap ( ) ;
201
202
0 commit comments