replace direct octokit deps with @actions/github types

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2026-01-28 16:29:31 +01:00
parent 2806b0ceaf
commit 537174131a
5 changed files with 30 additions and 33 deletions

View File

@@ -16,9 +16,6 @@
import * as core from '@actions/core';
import * as github from '@actions/github';
import {Octokit} from '@octokit/core';
import {restEndpointMethods} from '@octokit/plugin-rest-endpoint-methods';
import {Exec} from './exec.js';
import {GitHub} from './github.js';
@@ -47,9 +44,9 @@ export class Git {
// if we have a token and this is a GitHub repo we can use the GitHub API
if (token && repoMatch) {
core.setSecret(token);
const octokit = new (Octokit.plugin(restEndpointMethods).defaults({
const octokit = github.getOctokit(token, {
baseUrl: GitHub.apiURL
}))({auth: token});
});
const [owner, repoName] = repoMatch.slice(1, 3);
try {
return (

View File

@@ -16,7 +16,7 @@
import * as core from '@actions/core';
import {AnnotationProperties} from '@actions/core';
import {components as OctoOpenApiTypes} from '@octokit/openapi-types';
import type {getOctokit} from '@actions/github';
import {JwtPayload} from 'jwt-decode';
import {BakeDefinition} from './buildx/bake.js';
@@ -39,7 +39,8 @@ export interface GitHubContentOpts {
path: string;
}
export type GitHubRepo = OctoOpenApiTypes['schemas']['repository'];
type Octokit = ReturnType<typeof getOctokit>;
export type GitHubRepo = Awaited<ReturnType<Octokit['rest']['repos']['get']>>['data'];
export interface GitHubActionsRuntimeToken extends JwtPayload {
ac?: string;