Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github-cherry-pick

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github-cherry-pick - npm Package Compare versions

Comparing version 0.2.0 to 1.0.0

2

lib/index.d.ts

@@ -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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc