|
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,28 +60,28 @@ 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 |
| 70 | + let tree = await octokit.git |
71 | 71 | .getCommit({ owner, repo, commit_sha: commit }) |
72 | 72 | .then((result) => result.data.tree.sha) |
73 | | - tree = await octokit.gitdata |
| 73 | + tree = await octokit.git |
74 | 74 | .createTree({ |
75 | 75 | owner, |
76 | 76 | repo, |
77 | 77 | tree: [{ path: 'README.adoc', mode: '100644', type: 'blob', sha: readmeBlob }], |
78 | 78 | base_tree: tree, |
79 | 79 | }) |
80 | 80 | .then((result) => result.data.sha) |
81 | | - commit = await octokit.gitdata |
| 81 | + commit = await octokit.git |
82 | 82 | .createCommit({ owner, repo, message, tree, parents: [commit] }) |
83 | 83 | .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 }) |
85 | 85 | const uploadUrl = await octokit.repos |
86 | 86 | .createRelease({ |
87 | 87 | owner, |
|
0 commit comments