mirror of
https://github.com/docker/actions-toolkit.git
synced 2024-11-27 06:46:07 +08:00
github: move types
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
dea2294b93
commit
fe8b21ecf5
@ -18,13 +18,14 @@ import {describe, expect, jest, it, beforeEach, afterEach} from '@jest/globals';
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import {GitHub, GitHubRepo} from '../src/github';
|
import {GitHub} from '../src/github';
|
||||||
|
import {GitHubRepo} from '../src/types/github';
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jest.clearAllMocks();
|
jest.clearAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
import * as repoFixture from './fixtures/repo.json';
|
import repoFixture from './fixtures/repo.json';
|
||||||
jest.spyOn(GitHub.prototype, 'repoData').mockImplementation((): Promise<GitHubRepo> => {
|
jest.spyOn(GitHub.prototype, 'repoData').mockImplementation((): Promise<GitHubRepo> => {
|
||||||
return <Promise<GitHubRepo>>(repoFixture as unknown);
|
return <Promise<GitHubRepo>>(repoFixture as unknown);
|
||||||
});
|
});
|
||||||
|
@ -16,15 +16,10 @@
|
|||||||
|
|
||||||
import {GitHub as Octokit} from '@actions/github/lib/utils';
|
import {GitHub as Octokit} from '@actions/github/lib/utils';
|
||||||
import * as github from '@actions/github';
|
import * as github from '@actions/github';
|
||||||
import {components as OctoOpenApiTypes} from '@octokit/openapi-types';
|
|
||||||
import jwt_decode, {JwtPayload} from 'jwt-decode';
|
|
||||||
import {Context} from '@actions/github/lib/context';
|
import {Context} from '@actions/github/lib/context';
|
||||||
|
import jwt_decode from 'jwt-decode';
|
||||||
|
|
||||||
export type GitHubRepo = OctoOpenApiTypes['schemas']['repository'];
|
import {GitHubActionsRuntimeToken, GitHubRepo} from './types/github';
|
||||||
|
|
||||||
export interface GitHubActionsRuntimeToken extends JwtPayload {
|
|
||||||
ac?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GitHubOpts {
|
export interface GitHubOpts {
|
||||||
token?: string;
|
token?: string;
|
||||||
|
@ -14,9 +14,18 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import {components as OctoOpenApiTypes} from '@octokit/openapi-types';
|
||||||
|
import {JwtPayload} from 'jwt-decode';
|
||||||
|
|
||||||
export interface GitHubRelease {
|
export interface GitHubRelease {
|
||||||
id: number;
|
id: number;
|
||||||
tag_name: string;
|
tag_name: string;
|
||||||
html_url: string;
|
html_url: string;
|
||||||
assets: Array<string>;
|
assets: Array<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type GitHubRepo = OctoOpenApiTypes['schemas']['repository'];
|
||||||
|
|
||||||
|
export interface GitHubActionsRuntimeToken extends JwtPayload {
|
||||||
|
ac?: string;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user