|
3 | 3 | const File = require('vinyl')
|
4 | 4 | const fs = require('fs-extra')
|
5 | 5 | const { obj: map } = require('through2')
|
6 |
| -const Octokit = require('@octokit/rest') |
| 6 | +const { Octokit } = require('@octokit/rest') |
7 | 7 | const path = require('path')
|
8 | 8 | const vfs = require('vinyl-fs')
|
9 | 9 | const zip = require('gulp-vinyl-zip')
|
@@ -60,26 +60,26 @@ module.exports = (dest, bundleName, owner, repo, token, updateBranch) => async (
|
60 | 60 | const message = `Release ${tagName}`
|
61 | 61 | const bundleFileBasename = `${bundleName}-bundle.zip`
|
62 | 62 | 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) |
64 | 64 | const readmeContent = await fs
|
65 | 65 | .readFile('README.adoc', 'utf-8')
|
66 | 66 | .then((contents) => contents.replace(/^(?:\/\/)?(:current-release: ).+$/m, `$1${tagName}`))
|
67 |
| - const readmeBlob = await octokit.gitdata |
| 67 | + const readmeBlob = await octokit.git |
68 | 68 | .createBlob({ owner, repo, content: readmeContent, encoding: 'utf-8' })
|
69 | 69 | .then((result) => result.data.sha)
|
70 |
| - let tree = await octokit.gitdata.getCommit({ owner, repo, commit_sha: commit }).then((result) => result.data.tree.sha) |
71 |
| - tree = await octokit.gitdata |
| 70 | + let tree = await octokit.git.getCommit({ owner, repo, commit_sha: commit }).then((result) => result.data.tree.sha) |
| 71 | + tree = await octokit.git |
72 | 72 | .createTree({
|
73 | 73 | owner,
|
74 | 74 | repo,
|
75 | 75 | tree: [{ path: 'README.adoc', mode: '100644', type: 'blob', sha: readmeBlob }],
|
76 | 76 | base_tree: tree,
|
77 | 77 | })
|
78 | 78 | .then((result) => result.data.sha)
|
79 |
| - commit = await octokit.gitdata |
| 79 | + commit = await octokit.git |
80 | 80 | .createCommit({ owner, repo, message, tree, parents: [commit] })
|
81 | 81 | .then((result) => result.data.sha)
|
82 |
| - if (updateBranch) await octokit.gitdata.updateRef({ owner, repo, ref, sha: commit }) |
| 82 | + if (updateBranch) await octokit.git.updateRef({ owner, repo, ref, sha: commit }) |
83 | 83 | const uploadUrl = await octokit.repos
|
84 | 84 | .createRelease({
|
85 | 85 | owner,
|
|
0 commit comments