Skip to content

Commit 97905dc

Browse files
committed
fix: switch to import for @octokit/rest
1 parent d9b9b91 commit 97905dc

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

lib/release/release-manager.js

+15-16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const { Octokit } = require('@octokit/rest')
21
const core = require('@actions/core')
32
const { join } = require('path')
43
const semver = require('semver')
@@ -9,17 +8,16 @@ const { request: fetch } = require('undici')
98
const { getPublishTag, block, noop } = require('./util')
109

1110
class ReleaseManager {
12-
#octokit
13-
#owner
14-
#repo
15-
#cwd
16-
#pr
1711
#backport
12+
#cwd
1813
#defaultTag
14+
#info
1915
#lockfile
16+
#owner
17+
#pr
2018
#publish
21-
22-
#info
19+
#repo
20+
#token
2321

2422
constructor({ token, repo, cwd = process.cwd(), pr, backport, defaultTag, lockfile, publish, silent }) {
2523
assert(token, 'GITHUB_TOKEN is required')
@@ -28,17 +26,16 @@ class ReleaseManager {
2826
assert(pr, 'pr is required')
2927
assert(defaultTag, 'defaultTag is required')
3028

31-
this.#octokit = new Octokit({ auth: token })
32-
this.#owner = repo.split('/')[0]
33-
this.#repo = repo.split('/')[1]
34-
this.#cwd = cwd
35-
this.#pr = pr
3629
this.#backport = backport
30+
this.#cwd = cwd
3731
this.#defaultTag = defaultTag
32+
this.#info = silent ? noop : core.info
3833
this.#lockfile = lockfile
34+
this.#owner = repo.split('/')[0]
35+
this.#pr = pr
3936
this.#publish = publish
40-
41-
this.#info = silent ? noop : core.info
37+
this.#repo = repo.split('/')[1]
38+
this.#token = token
4239
}
4340

4441
static async run(options) {
@@ -47,7 +44,9 @@ class ReleaseManager {
4744
}
4845

4946
async run() {
50-
const { data: pullRequest } = await this.#octokit.rest.pulls.get({
47+
const { Octokit } = await import('@octokit/rest')
48+
const octokit = new Octokit({ auth: this.#token })
49+
const { data: pullRequest } = await octokit.rest.pulls.get({
5150
owner: this.#owner,
5251
repo: this.#repo,
5352
pull_number: this.#pr,

0 commit comments

Comments
 (0)