Skip to content

Commit f37f07c

Browse files
authored
Merge pull request #3 from cainwatson/fix/security-vulnerability
Fix/security vulnerability
2 parents 6530766 + 0df39de commit f37f07c

File tree

3 files changed

+1210
-233
lines changed

3 files changed

+1210
-233
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"@types/node": "^8.0.46",
4646
"cross-env": "^5.1.0",
4747
"husky": "^0.14.3",
48-
"lint-staged": "^4.3.0",
48+
"lint-staged": "^8.1.0",
4949
"mocha": "^4.0.1",
5050
"prettier": "^1.7.4",
5151
"ts-node": "^3.3.0",
@@ -63,8 +63,8 @@
6363
},
6464
"types": "lib/git-commit-push-via-github-api.d.ts",
6565
"dependencies": {
66+
"@octokit/rest": "^16.3.0",
6667
"@types/debug": "^0.0.30",
67-
"debug": "^3.1.0",
68-
"github": "^11.0.0"
68+
"debug": "^3.1.0"
6969
}
7070
}

src/git-commit-push-via-github-api.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import * as GitHubApi from "github";
1+
import * as GitHubApi from "@octokit/rest";
22

33
const debug = require("debug")("git-commit-push-via-github-api");
44
const GITHUB_API_TOKEN = process.env.GITHUB_API_TOKEN;
55
const getReferenceCommit = function(github: GitHubApi, options: GitCommitPushOptions) {
66
return new Promise((resolve, reject) => {
7-
github.gitdata.getReference(
7+
github.git.getRef(
88
{
99
owner: options.owner,
1010
repo: options.repo,
@@ -26,7 +26,7 @@ const createTree = function(github: GitHubApi, options: GitCommitPushOptions, da
2626
return new Promise((resolve, reject) => {
2727
const promises = options.files.map(file => {
2828
if (typeof file.path === "string" && typeof file.content === "string") {
29-
return github.gitdata
29+
return github.git
3030
.createBlob({
3131
owner: options.owner,
3232
repo: options.repo,
@@ -42,7 +42,7 @@ const createTree = function(github: GitHubApi, options: GitCommitPushOptions, da
4242
};
4343
});
4444
} else if (typeof file.path === "string" && Buffer.isBuffer(file.content)) {
45-
return github.gitdata
45+
return github.git
4646
.createBlob({
4747
owner: options.owner,
4848
repo: options.repo,
@@ -63,7 +63,7 @@ const createTree = function(github: GitHubApi, options: GitCommitPushOptions, da
6363
return Promise.all(promises).then(files => {
6464
debug("files: %O", files);
6565
// TODO: d.ts bug?
66-
github.gitdata.createTree(
66+
github.git.createTree(
6767
{
6868
owner: options.owner,
6969
repo: options.repo,
@@ -85,7 +85,7 @@ const createTree = function(github: GitHubApi, options: GitCommitPushOptions, da
8585

8686
const createCommit = function(github: GitHubApi, options: GitCommitPushOptions, data: any) {
8787
return new Promise((resolve, reject) => {
88-
github.gitdata.createCommit(
88+
github.git.createCommit(
8989
{
9090
owner: options.owner,
9191
repo: options.repo,
@@ -107,7 +107,7 @@ const createCommit = function(github: GitHubApi, options: GitCommitPushOptions,
107107

108108
const updateReference = function(github: GitHubApi, options: GitCommitPushOptions, data: any) {
109109
return new Promise((resolve, reject) => {
110-
github.gitdata.updateReference(
110+
github.git.updateRef(
111111
{
112112
owner: options.owner,
113113
repo: options.repo,

0 commit comments

Comments
 (0)