2020-10-25 01:25:23 +00:00
|
|
|
import * as github from '@actions/github';
|
|
|
|
import {Context} from '@actions/github/lib/context';
|
2021-05-25 00:07:25 +00:00
|
|
|
import {components as OctoOpenApiTypes} from '@octokit/openapi-types';
|
|
|
|
|
|
|
|
export type ReposGetResponseData = OctoOpenApiTypes['schemas']['repository'];
|
2020-10-25 01:25:23 +00:00
|
|
|
|
|
|
|
export function context(): Context {
|
|
|
|
return github.context;
|
|
|
|
}
|
|
|
|
|
|
|
|
export async function repo(token: string): Promise<ReposGetResponseData> {
|
2021-05-25 00:07:25 +00:00
|
|
|
return github
|
|
|
|
.getOctokit(token)
|
2022-04-19 11:18:06 +00:00
|
|
|
.rest.repos.get({...github.context.repo})
|
2021-05-25 00:07:25 +00:00
|
|
|
.then(response => response.data as ReposGetResponseData);
|
2020-10-25 01:25:23 +00:00
|
|
|
}
|