Skip to content
This repository was archived by the owner on May 15, 2021. It is now read-only.

Commit 15c4314

Browse files
fix: octokit types
1 parent 40ba0ad commit 15c4314

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Diff for: src/utils/workflow.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type {OctokitResponse} from '@octokit/types';
2-
import type {PaginateInterface} from '@octokit/plugin-paginate-rest';
32
import type {Octokit} from '@technote-space/github-action-helper/dist/types';
43
import type {Context} from '@actions/github/lib/context';
54
import type {Logger} from '@technote-space/github-action-log-helper';
@@ -11,7 +10,7 @@ type ActionsGetWorkflowRunResponseData = components['schemas']['workflow-run'];
1110
type ActionsListWorkflowRunsResponseData = components['schemas']['workflow-run'];
1211

1312
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({
1514
owner: context.repo.owner,
1615
repo: context.repo.repo,
1716
'run_id': runId,
@@ -54,8 +53,8 @@ export const getWorkflowRuns = async(workflowId: number, logger: Logger, octokit
5453
options.branch = branch;
5554
}
5655

57-
return (await (octokit.paginate as PaginateInterface)(
58-
octokit.actions.listWorkflowRuns,
56+
return (await octokit.paginate(
57+
octokit.rest.actions.listWorkflowRuns,
5958
// eslint-disable-next-line no-warning-comments
6059
// TODO: remove ts-ignore after fixed types (https://github.com/octokit/types.ts/issues/122)
6160
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -64,7 +63,7 @@ export const getWorkflowRuns = async(workflowId: number, logger: Logger, octokit
6463
)).map(run => run as ActionsListWorkflowRunsResponseData).filter(run => run.event === context.eventName).filter(isNotExcludeRun);
6564
};
6665

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({
6867
...context.repo,
6968
'run_id': runId,
7069
});

0 commit comments

Comments
 (0)