From 9348f81855b06da42c1abd815274e83805ed324b Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Wed, 28 Jan 2026 12:08:36 +0100 Subject: [PATCH] git: drop types/git and inline GitHub context type Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- src/git.ts | 6 +++--- src/github.ts | 6 ++---- src/types/git.ts | 19 ------------------- 3 files changed, 5 insertions(+), 26 deletions(-) delete mode 100644 src/types/git.ts diff --git a/src/git.ts b/src/git.ts index 879727f..b69f50b 100644 --- a/src/git.ts +++ b/src/git.ts @@ -15,18 +15,18 @@ */ 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'; -import {Context} from '@actions/github/lib/context'; -import {Context as GitContext} from './types/git.js'; +export type GitContext = typeof github.context; export class Git { public static async context(): Promise { - const ctx = new Context(); + const ctx = {...github.context} as GitContext; ctx.ref = await Git.ref(); ctx.sha = await Git.fullCommit(); return ctx; diff --git a/src/github.ts b/src/github.ts index 3d31fda..de943f7 100644 --- a/src/github.ts +++ b/src/github.ts @@ -29,8 +29,6 @@ import {InvalidResponseError, NetworkError} from '@actions/artifact'; import * as core from '@actions/core'; import {SummaryTableCell} from '@actions/core/lib/summary'; import * as github from '@actions/github'; -import {GitHub as Octokit} from '@actions/github/lib/utils'; -import {Context} from '@actions/github/lib/context'; import * as httpm from '@actions/http-client'; import {TransferProgressEvent} from '@azure/core-rest-pipeline'; import {BlobClient, BlobHTTPHeaders} from '@azure/storage-blob'; @@ -46,7 +44,7 @@ export interface GitHubOpts { export class GitHub { private readonly githubToken?: string; - public readonly octokit: InstanceType; + public readonly octokit: ReturnType; constructor(opts?: GitHubOpts) { this.githubToken = opts?.token || process.env.GITHUB_TOKEN; @@ -87,7 +85,7 @@ export class GitHub { return >JSON.parse(dt); } - static get context(): Context { + static get context(): typeof github.context { return github.context; } diff --git a/src/types/git.ts b/src/types/git.ts deleted file mode 100644 index 47cd3d0..0000000 --- a/src/types/git.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright 2023 actions-toolkit authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import {Context as GitHubContext} from '@actions/github/lib/context'; - -export type Context = GitHubContext;