Skip to content

Commit

Permalink
fix: switch to import for @octokit/rest
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed Jul 1, 2024
1 parent d9b9b91 commit 97905dc
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions lib/release/release-manager.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const { Octokit } = require('@octokit/rest')
const core = require('@actions/core')
const { join } = require('path')
const semver = require('semver')
Expand All @@ -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')
Expand All @@ -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) {
Expand All @@ -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,
Expand Down

0 comments on commit 97905dc

Please sign in to comment.