From 57b8b60eb6a227514e3ed16dca096de4fdb999d2 Mon Sep 17 00:00:00 2001 From: Michael Heap Date: Fri, 14 Nov 2025 12:07:19 +0000 Subject: [PATCH] Allow Octokit instances with plugins to be provided --- create-or-update-files.ts | 12 ++++++------ index.ts | 2 +- package.json | 5 ++++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/create-or-update-files.ts b/create-or-update-files.ts index 4dd69af..0a5383d 100644 --- a/create-or-update-files.ts +++ b/create-or-update-files.ts @@ -57,7 +57,7 @@ function isBase64(str: string | Buffer): boolean { } export default function ( - octokit: Octokit, + octokit: Octokit | any, opts: Options, ): Promise { return new Promise(async (resolve, reject) => { @@ -295,7 +295,7 @@ export default function ( } async function fileExistsInRepo( - octokit: Octokit, + octokit: Octokit | any, owner: string, repo: string, path: string, @@ -316,7 +316,7 @@ async function fileExistsInRepo( } async function createCommit( - octokit: Octokit, + octokit: Octokit | any, owner: string, repo: string, committer: RestEndpointMethodTypes["git"]["createCommit"]["parameters"]["committer"], @@ -339,7 +339,7 @@ async function createCommit( } async function createTree( - octokit: Octokit, + octokit: Octokit | any, owner: string, repo: string, treeItems: Array< @@ -358,7 +358,7 @@ async function createTree( } async function createBlob( - octokit: Octokit, + octokit: Octokit | any, owner: string, repo: string, contents: string | Buffer, @@ -390,7 +390,7 @@ async function createBlob( } async function loadRef( - octokit: Octokit, + octokit: Octokit | any, owner: string, repo: string, ref: string, diff --git a/index.ts b/index.ts index 7c16a29..22894a1 100644 --- a/index.ts +++ b/index.ts @@ -2,7 +2,7 @@ import { Octokit } from "@octokit/rest"; import createOrUpdateFilesPlugin from "./create-or-update-files"; -export default function (octokit: Octokit) { +export default function (octokit: Octokit | any) { return { createOrUpdateFiles: createOrUpdateFilesPlugin.bind(null, octokit), }; diff --git a/package.json b/package.json index b102374..2ba7e47 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,9 @@ "description": "Octokit plugin to create/update multiple files at once", "main": "dist/index.js", "types": "dist/index.d.ts", + "files": [ + "dist" + ], "scripts": { "build": "tsc", "test": "npm run build && jest", @@ -36,4 +39,4 @@ "peerDependencies": { "@octokit/rest": ">=20.0.1" } -} +} \ No newline at end of file