File tree Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Expand file tree Collapse file tree 1 file changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -29,9 +29,9 @@ export const fetchInstallationToken = async ({
29
29
} ) ,
30
30
} ) ;
31
31
32
+ const authApp = await app ( { type : "app" } ) ;
33
+ const octokit = getOctokit ( authApp . token ) ;
32
34
if ( installationId === undefined ) {
33
- const authApp = await app ( { type : "app" } ) ;
34
- const octokit = getOctokit ( authApp . token ) ;
35
35
try {
36
36
( {
37
37
data : { id : installationId } ,
@@ -44,10 +44,16 @@ export const fetchInstallationToken = async ({
44
44
}
45
45
}
46
46
47
- const installation = await app ( {
48
- installationId,
49
- permissions,
50
- type : "installation" ,
51
- } ) ;
52
- return installation . token ;
47
+ try {
48
+ const { data : installation } =
49
+ await octokit . rest . apps . createInstallationAccessToken ( {
50
+ installation_id : installationId ,
51
+ permissions,
52
+ } ) ;
53
+ return installation ?. token ;
54
+ } catch ( error : unknown ) {
55
+ throw new Error ( "Could not create installation access token." , {
56
+ cause : ensureError ( error ) ,
57
+ } ) ;
58
+ }
53
59
} ;
You can’t perform that action at this time.
0 commit comments