Skip to content

Commit d7f69fb

Browse files
committed
update octokit and update code to align with new API
1 parent 3e9f021 commit d7f69fb

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

gulp.d/tasks/release.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const File = require('vinyl')
44
const fs = require('fs-extra')
55
const { obj: map } = require('through2')
6-
const Octokit = require('@octokit/rest')
6+
const { Octokit } = require('@octokit/rest')
77
const path = require('path')
88
const vfs = require('vinyl-fs')
99
const zip = require('gulp-vinyl-zip')
@@ -60,28 +60,28 @@ module.exports = (dest, bundleName, owner, repo, token, updateBranch) => async (
6060
const message = `Release ${tagName}`
6161
const bundleFileBasename = `${bundleName}-bundle.zip`
6262
const bundleFile = await versionBundle(path.join(dest, bundleFileBasename), tagName)
63-
let commit = await octokit.gitdata.getRef({ owner, repo, ref }).then((result) => result.data.object.sha)
63+
let commit = await octokit.git.getRef({ owner, repo, ref }).then((result) => result.data.object.sha)
6464
const readmeContent = await fs
6565
.readFile('README.adoc', 'utf-8')
6666
.then((contents) => contents.replace(/^(?:\/\/)?(:current-release: ).+$/m, `$1${tagName}`))
67-
const readmeBlob = await octokit.gitdata
67+
const readmeBlob = await octokit.git
6868
.createBlob({ owner, repo, content: readmeContent, encoding: 'utf-8' })
6969
.then((result) => result.data.sha)
70-
let tree = await octokit.gitdata
70+
let tree = await octokit.git
7171
.getCommit({ owner, repo, commit_sha: commit })
7272
.then((result) => result.data.tree.sha)
73-
tree = await octokit.gitdata
73+
tree = await octokit.git
7474
.createTree({
7575
owner,
7676
repo,
7777
tree: [{ path: 'README.adoc', mode: '100644', type: 'blob', sha: readmeBlob }],
7878
base_tree: tree,
7979
})
8080
.then((result) => result.data.sha)
81-
commit = await octokit.gitdata
81+
commit = await octokit.git
8282
.createCommit({ owner, repo, message, tree, parents: [commit] })
8383
.then((result) => result.data.sha)
84-
if (updateBranch) await octokit.gitdata.updateRef({ owner, repo, ref, sha: commit })
84+
if (updateBranch) await octokit.git.updateRef({ owner, repo, ref, sha: commit })
8585
const uploadUrl = await octokit.repos
8686
.createRelease({
8787
owner,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"last 2 versions"
1515
],
1616
"devDependencies": {
17-
"@octokit/rest": "~16.30",
17+
"@octokit/rest": "~18.0",
1818
"asciidoctor.js": "1.5.9",
1919
"autoprefixer": "~9.6",
2020
"browser-pack-flat": "~3.4",

0 commit comments

Comments
 (0)