diff --git a/lib/release/release-manager.js b/lib/release/release-manager.js index 91b673a9..fb4ae84e 100644 --- a/lib/release/release-manager.js +++ b/lib/release/release-manager.js @@ -1,4 +1,3 @@ -const { Octokit } = require('@octokit/rest') const core = require('@actions/core') const { join } = require('path') const semver = require('semver') @@ -9,17 +8,16 @@ const { request: fetch } = require('undici') const { getPublishTag, block, noop } = require('./util') class ReleaseManager { - #octokit - #owner - #repo - #cwd - #pr #backport + #cwd #defaultTag + #info #lockfile + #owner + #pr #publish - - #info + #repo + #token constructor({ token, repo, cwd = process.cwd(), pr, backport, defaultTag, lockfile, publish, silent }) { assert(token, 'GITHUB_TOKEN is required') @@ -28,17 +26,16 @@ class ReleaseManager { assert(pr, 'pr is required') assert(defaultTag, 'defaultTag is required') - this.#octokit = new Octokit({ auth: token }) - this.#owner = repo.split('/')[0] - this.#repo = repo.split('/')[1] - this.#cwd = cwd - this.#pr = pr this.#backport = backport + this.#cwd = cwd this.#defaultTag = defaultTag + this.#info = silent ? noop : core.info this.#lockfile = lockfile + this.#owner = repo.split('/')[0] + this.#pr = pr this.#publish = publish - - this.#info = silent ? noop : core.info + this.#repo = repo.split('/')[1] + this.#token = token } static async run(options) { @@ -47,7 +44,9 @@ class ReleaseManager { } async run() { - const { data: pullRequest } = await this.#octokit.rest.pulls.get({ + const { Octokit } = await import('@octokit/rest') + const octokit = new Octokit({ auth: this.#token }) + const { data: pullRequest } = await octokit.rest.pulls.get({ owner: this.#owner, repo: this.#repo, pull_number: this.#pr,