1
1
import type { OctokitResponse } from '@octokit/types' ;
2
- import type { PaginateInterface } from '@octokit/plugin-paginate-rest' ;
3
2
import type { Octokit } from '@technote-space/github-action-helper/dist/types' ;
4
3
import type { Context } from '@actions/github/lib/context' ;
5
4
import type { Logger } from '@technote-space/github-action-log-helper' ;
@@ -11,7 +10,7 @@ type ActionsGetWorkflowRunResponseData = components['schemas']['workflow-run'];
11
10
type ActionsListWorkflowRunsResponseData = components [ 'schemas' ] [ 'workflow-run' ] ;
12
11
13
12
export const getWorkflowRun = async ( runId : number , octokit : Octokit , context : Context ) : Promise < ActionsGetWorkflowRunResponseData > => {
14
- return ( await octokit . actions . getWorkflowRun ( {
13
+ return ( await octokit . rest . actions . getWorkflowRun ( {
15
14
owner : context . repo . owner ,
16
15
repo : context . repo . repo ,
17
16
'run_id' : runId ,
@@ -54,8 +53,8 @@ export const getWorkflowRuns = async(workflowId: number, logger: Logger, octokit
54
53
options . branch = branch ;
55
54
}
56
55
57
- return ( await ( octokit . paginate as PaginateInterface ) (
58
- octokit . actions . listWorkflowRuns ,
56
+ return ( await octokit . paginate (
57
+ octokit . rest . actions . listWorkflowRuns ,
59
58
// eslint-disable-next-line no-warning-comments
60
59
// TODO: remove ts-ignore after fixed types (https://github.com/octokit/types.ts/issues/122)
61
60
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -64,7 +63,7 @@ export const getWorkflowRuns = async(workflowId: number, logger: Logger, octokit
64
63
) ) . map ( run => run as ActionsListWorkflowRunsResponseData ) . filter ( run => run . event === context . eventName ) . filter ( isNotExcludeRun ) ;
65
64
} ;
66
65
67
- export const cancelWorkflowRun = async ( runId : number , octokit : Octokit , context : Context ) : Promise < OctokitResponse < { [ key : string ] : unknown ; } > > => octokit . actions . cancelWorkflowRun ( {
66
+ export const cancelWorkflowRun = async ( runId : number , octokit : Octokit , context : Context ) : Promise < OctokitResponse < { [ key : string ] : unknown ; } > > => octokit . rest . actions . cancelWorkflowRun ( {
68
67
...context . repo ,
69
68
'run_id' : runId ,
70
69
} ) ;
0 commit comments