github-cherry-pick
Advanced tools
Comparing version 0.2.0 to 1.0.0
@@ -12,2 +12,2 @@ import * as Octokit from "@octokit/rest"; | ||
}) => Promise<string>; | ||
export default cherryPickCommits; | ||
export { cherryPickCommits }; |
@@ -15,3 +15,3 @@ "use strict"; | ||
const createCommit = ({ author, committer, message, octokit, owner, parent, repo, tree, }) => __awaiter(this, void 0, void 0, function* () { | ||
const { data: { sha }, } = yield octokit.gitdata.createCommit({ | ||
const { data: { sha }, } = yield octokit.git.createCommit({ | ||
author, | ||
@@ -39,3 +39,3 @@ committer, | ||
const retrieveCommitDetails = ({ commit, octokit, owner, repo, }) => __awaiter(this, void 0, void 0, function* () { | ||
const { data: { author, committer, message, parents: [{ sha: parent }], }, } = yield octokit.gitdata.getCommit({ | ||
const { data: { author, committer, message, parents: [{ sha: parent }], }, } = yield octokit.git.getCommit({ | ||
commit_sha: commit, | ||
@@ -58,3 +58,3 @@ owner, | ||
}); | ||
yield git_1.updateReference({ | ||
yield git_1.updateRef({ | ||
force: true, | ||
@@ -103,4 +103,4 @@ octokit, | ||
}); | ||
debug("updating reference", newHeadSha); | ||
yield git_1.updateReference({ | ||
debug("updating ref", newHeadSha); | ||
yield git_1.updateRef({ | ||
// Overwrite the merge commit and its parent on the branch by a single commit. | ||
@@ -120,4 +120,4 @@ // The result will be equivalent to what would have happened with a fast-forward merge. | ||
}); | ||
const cherryPickCommitsOnReference = ({ commits, initialHeadSha, octokit, owner, ref, repo, }) => __awaiter(this, void 0, void 0, function* () { | ||
const { data: { tree: { sha: initialHeadTree }, }, } = yield octokit.gitdata.getCommit({ | ||
const cherryPickCommitsOnRef = ({ commits, initialHeadSha, octokit, owner, ref, repo, }) => __awaiter(this, void 0, void 0, function* () { | ||
const { data: { tree: { sha: initialHeadTree }, }, } = yield octokit.git.getCommit({ | ||
commit_sha: initialHeadSha, | ||
@@ -148,3 +148,3 @@ owner, | ||
debug("starting", { commits, head, owner, repo }); | ||
const initialHeadSha = yield git_1.fetchReferenceSha({ | ||
const initialHeadSha = yield git_1.fetchRefSha({ | ||
octokit, | ||
@@ -156,6 +156,6 @@ owner, | ||
yield _intercept({ initialHeadSha }); | ||
return git_1.withTemporaryReference({ | ||
return git_1.withTemporaryRef({ | ||
action: (temporaryRef) => __awaiter(this, void 0, void 0, function* () { | ||
debug({ temporaryRef }); | ||
const newSha = yield cherryPickCommitsOnReference({ | ||
const newSha = yield cherryPickCommitsOnRef({ | ||
commits, | ||
@@ -168,4 +168,4 @@ initialHeadSha, | ||
}); | ||
debug("updating reference with new SHA", newSha); | ||
yield git_1.updateReference({ | ||
debug("updating ref with new SHA", newSha); | ||
yield git_1.updateRef({ | ||
// Make sure it's a fast-forward update. | ||
@@ -179,3 +179,3 @@ force: false, | ||
}); | ||
debug("reference updated"); | ||
debug("ref updated"); | ||
return newSha; | ||
@@ -190,2 +190,2 @@ }), | ||
}); | ||
exports.default = cherryPickCommits; | ||
exports.cherryPickCommits = cherryPickCommits; |
{ | ||
"author": "Thibault Derousseaux <tibdex@gmail.com>", | ||
"dependencies": { | ||
"@octokit/rest": "^15.12.0", | ||
"@octokit/rest": "^16.8.0", | ||
"@types/debug": "^0.0.31", | ||
"@types/node": "^10.12.0", | ||
"debug": "^4.0.1", | ||
"shared-github-internals": "^0.2.0" | ||
"@types/node": "^10.12.18", | ||
"debug": "^4.1.1", | ||
"shared-github-internals": "^1.0.0" | ||
}, | ||
"description": "Cherry-pick several commits on a branch using the low level Git Data operations provided by the GitHub REST API", | ||
"devDependencies": { | ||
"@types/jest": "^23.3.5", | ||
"@types/jest": "^23.3.13", | ||
"jest": "^23.6.0", | ||
"jest-junit": "^5.1.0", | ||
"prettier": "^1.14.3", | ||
"ts-jest": "^23.10.4", | ||
"tslint": "^5.11.0", | ||
"tslint-config-prettier": "^1.15.0", | ||
"typescript": "^3.1.3" | ||
"jest-junit": "^6.0.1", | ||
"prettier": "^1.15.3", | ||
"ts-jest": "^23.10.5", | ||
"tslint": "^5.12.1", | ||
"tslint-config-prettier": "^1.17.0", | ||
"typescript": "^3.2.4" | ||
}, | ||
@@ -45,3 +45,3 @@ "engines": { | ||
}, | ||
"version": "0.2.0" | ||
"version": "1.0.0" | ||
} |
@@ -13,24 +13,23 @@ [![npm version](https://img.shields.io/npm/v/github-cherry-pick.svg)](https://npmjs.org/package/github-cherry-pick) | ||
```javascript | ||
import cherryPickCommits from "github-cherry-pick"; | ||
// const {default: cherryPickCommits} = require("github-cherry-pick"); | ||
import { cherryPickCommits } from "github-cherry-pick"; | ||
cherryPickCommits({ | ||
// The SHA list of the commits to cherry-pick. | ||
// The commits will be cherry-picked in the order they appear in the array. | ||
// See https://git-scm.com/docs/git-cherry-pick for more details. | ||
commits: [ | ||
"8b10a7808f06970232dc1b45a77b47d63641c4f1", | ||
"f393441512c54435819d1cdd8921c0d566911af3", | ||
], | ||
// The name of the branch/reference on top of which the commits will be cherry-picked. | ||
head: "awesome-feature", | ||
// An already authenticated instance of https://www.npmjs.com/package/@octokit/rest. | ||
octokit, | ||
// The username of the repository owner. | ||
owner, | ||
// The name of the repository. | ||
repo, | ||
}).then(newHeadSha => { | ||
// Do something. | ||
}); | ||
const example = async () => { | ||
const newHeadSha = await cherryPickCommits({ | ||
// The SHA list of the commits to cherry-pick. | ||
// The commits will be cherry-picked in the order they appear in the array. | ||
// See https://git-scm.com/docs/git-cherry-pick for more details. | ||
commits: [ | ||
"8b10a7808f06970232dc1b45a77b47d63641c4f1", | ||
"f393441512c54435819d1cdd8921c0d566911af3", | ||
], | ||
// The name of the branch/reference on top of which the commits will be cherry-picked. | ||
head: "awesome-feature", | ||
// An already authenticated instance of https://www.npmjs.com/package/@octokit/rest. | ||
octokit, | ||
// The username of the repository owner. | ||
owner, | ||
// The name of the repository. | ||
repo, | ||
}); | ||
}; | ||
``` | ||
@@ -37,0 +36,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
0
14666
194
+ Added@octokit/auth-token@2.5.05.1.1(transitive)
+ Added@octokit/core@6.1.2(transitive)
+ Added@octokit/endpoint@10.1.16.0.12(transitive)
+ Added@octokit/graphql@8.1.1(transitive)
+ Added@octokit/openapi-types@12.11.022.2.0(transitive)
+ Added@octokit/plugin-paginate-rest@1.1.2(transitive)
+ Added@octokit/plugin-request-log@1.0.4(transitive)
+ Added@octokit/plugin-rest-endpoint-methods@2.4.0(transitive)
+ Added@octokit/request@5.6.39.1.3(transitive)
+ Added@octokit/request-error@1.2.12.1.06.1.5(transitive)
+ Added@octokit/rest@16.43.2(transitive)
+ Added@octokit/types@13.6.12.16.26.41.0(transitive)
+ Added@types/tempy@0.3.0(transitive)
+ Addedatob-lite@2.0.0(transitive)
+ Addedbefore-after-hook@2.2.33.0.2(transitive)
+ Addeddeprecation@2.3.1(transitive)
+ Addedenvalid@5.0.0(transitive)
+ Addedis-plain-object@5.0.0(transitive)
+ Addedlodash.get@4.4.2(transitive)
+ Addedlodash.set@4.3.2(transitive)
+ Addedlodash.uniq@4.5.0(transitive)
+ Addedoctokit-pagination-methods@1.1.0(transitive)
+ Addedshared-github-internals@1.1.2(transitive)
+ Addedtempy@0.3.0(transitive)
+ Addedtype-fest@0.3.1(transitive)
+ Addeduniversal-user-agent@4.0.16.0.17.0.2(transitive)
- Removed@octokit/rest@15.18.3(transitive)
- Removed@types/tempy@0.2.0(transitive)
- Removedagent-base@4.3.0(transitive)
- Removedbefore-after-hook@1.4.0(transitive)
- Removeddebug@3.1.03.2.7(transitive)
- Removedenvalid@4.2.2(transitive)
- Removedes6-promise@4.2.8(transitive)
- Removedes6-promisify@5.0.0(transitive)
- Removedhttp-proxy-agent@2.1.0(transitive)
- Removedhttps-proxy-agent@2.2.4(transitive)
- Removedlodash@4.17.21(transitive)
- Removedms@2.0.0(transitive)
- Removedshared-github-internals@0.2.0(transitive)
- Removedtempy@0.2.1(transitive)
- Removeduniversal-user-agent@2.1.0(transitive)
- Removedurl-template@2.0.8(transitive)
Updated@octokit/rest@^16.8.0
Updated@types/node@^10.12.18
Updateddebug@^4.1.1