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

git-apply-pr

Package Overview
Dependencies
Maintainers
3
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-apply-pr - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

52

apply-pr.js

@@ -30,3 +30,2 @@ #!/usr/bin/env node

var fs = require('fs');
var https = require('https');
var os = require('os');

@@ -40,2 +39,3 @@ var path = require('path');

var lstream = require('lstream');
var request = require('request');

@@ -46,9 +46,22 @@ if (!process.argv[2]) {

var args = /(.*)\/(.*)#(\d*)/i.exec(process.argv[2]);
if (!args) {
var ENABLE_PLUS_ONE = false;
var ownerRepoPrArg;
process.argv.slice(2).forEach(function(arg) {
if (!/^\-\-/.test(arg)) {
ownerRepoPrArg = arg;
return;
}
if (/^\-\-plusone/.test(arg)) {
ENABLE_PLUS_ONE = true;
return;
}
});
var ownerRepoPr = /(.*)\/(.*)#(\d*)/i.exec(ownerRepoPrArg);
if (!ownerRepoPr) {
exitWithMsg('Usage example: git-apply-pr joyent/node#1337');
}
var OWNER = args[1];
var REPO = args[2];
var PR = +args[3];
var OWNER = ownerRepoPr[1];
var REPO = ownerRepoPr[2];
var PR = +ownerRepoPr[3];
var HOST = 'github.com';

@@ -91,3 +104,3 @@

'PR': util.format('#%d', PR),
'PR-URL': util.format('/%s/%s/pull/%d', OWNER, REPO, PR),
'PR-URL': util.format('https://%s/%s/%s/pull/%d', HOST, OWNER, REPO, PR),
'Reviewed-By': {},

@@ -112,3 +125,3 @@ };

comments.forEach(function (comment) {
if (/lgtm/i.test(comment.body)) {
if (/lgtm/i.test(comment.body) || maybeTestForPlusone(comment.body)) {
var val = reviews[comment.user.login] || 0;

@@ -126,2 +139,10 @@ reviews[comment.user.login] = val + 1;

function maybeTestForPlusone(comment) {
if (!ENABLE_PLUS_ONE) {
return false;
}
return /\+1/.test(comment);
}
function resolveNames() {

@@ -153,9 +174,8 @@ var queue = Object.keys(OUTPUT['Reviewed-By']);

function applyPatch() {
var req = https.request({
hostname: HOST,
path: OUTPUT['PR-URL'] + '.patch',
}, function patchResponse(res) {
res.pipe(new lstream()).pipe(new Mutator()).pipe(process.stdout);
});
req.end();
request({
uri: OUTPUT['PR-URL'] + '.patch',
followAllRedirects: true
})
.pipe(new lstream()).pipe(new Mutator()).pipe(process.stdout);
}

@@ -196,3 +216,3 @@

this.m_message.push(util.format('PR: %s', OUTPUT['PR']));
this.m_message.push(util.format('PR-URL: https://%s%s', HOST, OUTPUT['PR-URL']));
this.m_message.push(util.format('PR-URL: %s', OUTPUT['PR-URL']));

@@ -199,0 +219,0 @@ var self = this;

{
"name": "git-apply-pr",
"version": "1.1.0",
"version": "1.2.0",
"description": "Apply GitHub Pull Requests",

@@ -8,5 +8,5 @@ "main": "apply-pr.js",

"github": "~0.2.3",
"lstream": "~0.0.4"
"lstream": "~0.0.4",
"request": "~2.55.0"
},
"devDependencies": {},
"scripts": {

@@ -13,0 +13,0 @@ "test": "echo \"Error: no test specified\" && exit 1"

@@ -9,3 +9,9 @@ # git-apply-pr

```
git-apply-pr joyent/node#1337
git-apply-pr joyent/git-apply-pr#4
```
To include support for using `+1` as a valid vote in favor of merging a pull
request, you can use the `--plusone` command line switch like following:
```
git-apply-pr --plusone apache/couchdb-fauxton#321
```
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