From 3835c108cc726ed96fe17e0257a99e8e430a4189 Mon Sep 17 00:00:00 2001 From: to1source Date: Thu, 24 Jun 2021 21:46:33 +0800 Subject: [PATCH 1/4] remove the old folder --- old/git-webhook-ci/LICENSE | 21 ---- old/git-webhook-ci/cli.js | 78 -------------- old/git-webhook-ci/index.js | 54 ---------- old/git-webhook-ci/lib/option.js | 11 -- .../lib/providers/gitee/gitee-class.js | 76 ------------- .../lib/providers/gitee/index.js | 37 ------- .../lib/providers/github/index.js | 55 ---------- .../lib/providers/gitlab/gitlab-class.js | 81 -------------- .../lib/providers/gitlab/index.js | 37 ------- old/git-webhook-ci/lib/providers/index.js | 23 ---- .../lib/providers/lib/base-tools.js | 48 --------- .../lib/providers/lib/helpers.js | 6 -- .../lib/providers/lib/server.js | 10 -- .../lib/providers/wechat/index.js | 31 ------ .../lib/providers/wechat/wechat-class.js | 84 --------------- old/git-webhook-ci/package.json | 102 ------------------ 16 files changed, 754 deletions(-) delete mode 100644 old/git-webhook-ci/LICENSE delete mode 100644 old/git-webhook-ci/cli.js delete mode 100644 old/git-webhook-ci/index.js delete mode 100644 old/git-webhook-ci/lib/option.js delete mode 100644 old/git-webhook-ci/lib/providers/gitee/gitee-class.js delete mode 100644 old/git-webhook-ci/lib/providers/gitee/index.js delete mode 100644 old/git-webhook-ci/lib/providers/github/index.js delete mode 100644 old/git-webhook-ci/lib/providers/gitlab/gitlab-class.js delete mode 100644 old/git-webhook-ci/lib/providers/gitlab/index.js delete mode 100644 old/git-webhook-ci/lib/providers/index.js delete mode 100644 old/git-webhook-ci/lib/providers/lib/base-tools.js delete mode 100644 old/git-webhook-ci/lib/providers/lib/helpers.js delete mode 100644 old/git-webhook-ci/lib/providers/lib/server.js delete mode 100644 old/git-webhook-ci/lib/providers/wechat/index.js delete mode 100644 old/git-webhook-ci/lib/providers/wechat/wechat-class.js delete mode 100644 old/git-webhook-ci/package.json diff --git a/old/git-webhook-ci/LICENSE b/old/git-webhook-ci/LICENSE deleted file mode 100644 index cebb77c..0000000 --- a/old/git-webhook-ci/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 NEWBRAN.CH (joelchu.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/old/git-webhook-ci/cli.js b/old/git-webhook-ci/cli.js deleted file mode 100644 index 1455af5..0000000 --- a/old/git-webhook-ci/cli.js +++ /dev/null @@ -1,78 +0,0 @@ -'use strict'; -/** - * Run from cli - * dir: '', - * path: '/webhook', - * port: 8081, - * branch: 'refs/heads/master', - * cmd: 'git pull origin master --no-edit' - */ -const gitWebhook = require('./index'); -const meow = require('meow'); -const cli = meow( - ` - Usage - $ node git-webhook-ci - - $ node git-webhook-ci --secret secret-from-github - - $ node git-webhook-ci --secret secret-from-github --cmd 'git pull origin develop' - - For wechat - - $ node git-webhook-ci -secret wechat-token --inited true --cmd 'some cmd' - `, - { - flags: { - provider: { - type: 'string', - alias: 'pr', - default: 'github' - }, - dir: { - type: 'string', - alias: 'd' - }, - path: { - type: 'string', - alias: 'p', - default: '/webhook' - }, - port: { - type: 'integer', - alias: 'po', - default: 8081 - }, - branch: { - type: 'string', - alias: 'b', - default: 'refs/heads/master' - }, - secret: { - type: 'string', - alias: 's', - default: '' - }, - cmd: { - type: 'string', - alias: 'c', - default: 'git pull origin master --no-edit' - }, - inited: { - type: 'boolean', - alias: 'i', - default: false - } - } - } -); -// Wrap into a method to call -const serve = function(p, flags) { - if (!p || p === '') { - throw new Error('You must provide the ! Check usage for more detail.'); - } - const config = Object.assign({ __caller__: 'meow' }, { dir: p }, flags); - return gitWebhook(config); -}; -// Run it -serve(cli.input[0], cli.flags); diff --git a/old/git-webhook-ci/index.js b/old/git-webhook-ci/index.js deleted file mode 100644 index a6ef11d..0000000 --- a/old/git-webhook-ci/index.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict'; -/** - * This is now only responsible for checking the options - * and call the correct provider - */ -const provider = require('./lib/providers'); -const defaultOptions = require('./lib/option'); -const debug = require('debug')('git-webhook-ci:main'); -const { spawn } = require('child_process'); - -// Create a callback to execute -const createCallback = function(cmd) { - return function(payload, opt) { - const process = spawn(cmd[0], cmd.filter((c, i) => i > 0), opt); - process.stdout.on('data', data => { - debug(`cmd stdout: ${data}`); - }); - process.stderr.on('data', data => { - debug(`cmd stderr: ${data}`); - }); - process.on('close', code => { - debug(`cmd exited with ${code}`); - }); - }; -}; -/** - * @param {object} config configuration for the function return - * @return {function} for calls - */ -const serve = options => { - if (typeof options !== 'object') { - throw new Error('Expecting options to be an object'); - } - const config = Object.assign({}, defaultOptions, options); - if (!config.secret || config.secret === '') { - throw new Error('You must provide the secret!'); - } - if (typeof config.cmd !== 'string' && typeof config.cmd !== 'function') { - throw new Error('Cmd must be a string or a function!'); - } - debug(config); - const createHandler = provider(config.provider); - // Return without Promise, because there is no need to - return createHandler( - config, - { - env: Object.assign({}, process.env), - cwd: config.dir ? config.dir : process.cwd() - }, - typeof config.cmd === 'function' ? config.cmd : createCallback(config.cmd.split(' ')) - ); -}; -// Export -module.exports = serve; diff --git a/old/git-webhook-ci/lib/option.js b/old/git-webhook-ci/lib/option.js deleted file mode 100644 index dd7093b..0000000 --- a/old/git-webhook-ci/lib/option.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Breakout the option here to make it cleaner - */ -module.exports = { - provider: 'gitlab', // For future use - dir: '', - path: '/webhook', - port: 8081, - branch: 'refs/heads/master', - cmd: 'git pull origin master --no-edit' -}; diff --git a/old/git-webhook-ci/lib/providers/gitee/gitee-class.js b/old/git-webhook-ci/lib/providers/gitee/gitee-class.js deleted file mode 100644 index 03c2398..0000000 --- a/old/git-webhook-ci/lib/providers/gitee/gitee-class.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Gitee implementation - */ -const BaseTools = require('../lib/base-tools'); -/** - * Main - */ -class GiteeHandler extends BaseTools { - constructor(options) { - super(options); - this.options = options; - } - - /** - * Main method - * @param {object} req the request - * @param {object} res the respond - * @param {function} callback res with 404 - * @return {null} nothing - */ - handler(req, res, callback) { - if (req.url.split('?').shift() !== this.options.path || req.method !== 'POST') { - return callback(); // The only time we use the callback - } - this._parsePayload(req).then(payload => { - this._verify(payload) - .then(result => { - this._resSuccess(res, req, result); - }) - .catch(err => { - this._resError(res, req, err); - }); - }); - } - - /** - * Verify the password field - * @param {object} payload Content - * @return {object} promise - */ - _verify(payload) { - return new Promise((resolver, rejecter) => { - // Log('parsed payload', payload); - if (payload.password === this.options.secret) { - resolver(payload); - } else { - rejecter(new Error('Verify failed')); - } - }); - } - - /** - * @param {object} res the respond - * @param {object} result the payload - * @return {null} nothing - */ - _resSuccess(res, req, result) { - res.writeHead(200, { 'content-type': 'application/json' }); - res.end('{"ok":true}'); - // Check the result if this is what we wanted - if (result.hook_name === 'push_hooks') { - this.emit('push', { - payload: result, - host: req.headers.host, - event: result.hook_name - }); - } else { - this.emit('error', { - msg: 'Not the event we are expecting', - event: result.hook_name - }); - } - } -} - -module.exports = GiteeHandler; diff --git a/old/git-webhook-ci/lib/providers/gitee/index.js b/old/git-webhook-ci/lib/providers/gitee/index.js deleted file mode 100644 index 58de0cd..0000000 --- a/old/git-webhook-ci/lib/providers/gitee/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Implement the Gitee class - */ - -const GiteeWebhook = require('./gitee-class'); -const debug = require('debug')('git-webhook-ci:gitee'); -const server = require('../lib/server'); - -// Main -module.exports = function(config, opt, callback) { - const gitee = new GiteeWebhook(config); - // Register all the event listeners here first - gitee.on('error', err => { - debug('error', err); - }); - // Finally the push is accepted - gitee.on('push', result => { - const ref = result.payload.ref; - if (config.branch === '*' || config.branch === ref) { - callback(result, opt, ref); - } else { - debug('Gitee webhook is not expecting this branch', ref); - } - }); - // Return the server instance - return server( - config, - (req, res) => { - gitee.handler(req, res, function(err) { - res.statusCode = 404; - debug('The url got called! [%s]', req.url, err); - res.end('-- no such location --'); - }); - }, - debug - ); -}; diff --git a/old/git-webhook-ci/lib/providers/github/index.js b/old/git-webhook-ci/lib/providers/github/index.js deleted file mode 100644 index 97d7505..0000000 --- a/old/git-webhook-ci/lib/providers/github/index.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Rewrite the module with ES6, then ditch github-webhook-handler deps - */ -'use strict'; -/** - * Webhook for github to build a cheap and cheerful CI - * 1. Only do something when the master branch is updated - * 2. Only affect ./ folder to do a git pull master - * 3. Restart the script accordingly - * The github-webook-handler won't work with other git provider - * @TODO if I want to work with gitee / gitlab then I need to write one myself - */ -const server = require('../lib/server'); -const githubWebhook = require('github-webhook-handler'); -const debug = require('debug')('git-webhook-ci:gitlab'); -/** - * @param {object} config configuration for the function return - * @return {function} for calls - */ -const handler = (config, opt, callback) => { - const _handler = githubWebhook({ - path: config.path, - secret: config.secret - }); - // Start up server - const serverInt = server( - config, - (req, res) => { - _handler(req, res, function(err) { - res.statusCode = 404; - debug('The url got called! [%s]', req.url, err); - res.end('-- no such location --'); - }); - }, - debug - ); - - // On error - _handler.on('error', err => { - debug('Error:', err.message); - }); - // On received push event - _handler.on('push', result => { - const ref = result.payload.ref; - if (config.branch === '*' || config.branch === ref) { - callback(result, opt, ref); - } else { - debug('Received a push event for %s to %s', result.payload.repository.name, ref); - } - }); - // Return the server instance for stop or restart - return serverInt; -}; -// Export -module.exports = handler; diff --git a/old/git-webhook-ci/lib/providers/gitlab/gitlab-class.js b/old/git-webhook-ci/lib/providers/gitlab/gitlab-class.js deleted file mode 100644 index d319f3a..0000000 --- a/old/git-webhook-ci/lib/providers/gitlab/gitlab-class.js +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Gitlab base class - */ -const BaseTools = require('../lib/base-tools'); -/** - * Main - */ -class GitlabHandler extends BaseTools { - constructor(options) { - super(); - this.options = options; - } - - /** - * Main method - * @param {object} req the request - * @param {object} res the respond - * @param {function} callback res with 404 - * @return {null} nothing - */ - handler(req, res, callback) { - if (req.url.split('?').shift() !== this.options.path || req.method !== 'POST') { - return callback(); // The only time we use the callback - } - this._parsePayload(req).then(payload => { - const headers = req.headers; // JSON.stringify(req.headers, replacer); - // cache = null; - this._verify(payload, headers) - .then(payload => { - this._resSuccess(res, req, payload); - }) - .catch(err => { - this._resError(res, req, err); - }); - }); - } - - /** - * Verify the password field - * @param {object} payload Content - * @param {object} headers headers looking for the X-Gitlab-Event: Push Hook - * @return {object} promise - */ - _verify(payload, headers) { - const eventName = 'X-Gitlab-Event'.toLowerCase(); - const token = 'X-Gitlab-Token'.toLowerCase(); - // Console.log('headers', headers, typeof headers); - return new Promise((resolver, rejecter) => { - if (headers[eventName] === 'Push Hook' && headers[token] === this.options.secret) { - resolver(payload); - } else { - rejecter(new Error('Verify failed')); - } - }); - } - - /** - * @param {object} res the respond - * @param {object} result the payload - * @return {null} nothing - */ - _resSuccess(res, req, payload) { - res.writeHead(200, { 'content-type': 'application/json' }); - res.end('{"ok":true}'); - // Check the result if this is what we wanted - if (payload.object_kind === 'push') { - this.emit('push', { - payload: payload, - host: req.headers.host, - event: payload.object_kind - }); - } else { - this.emit('error', { - msg: 'Not the event we are expecting', - event: payload.object_kind - }); - } - } -} -// Export -module.exports = GitlabHandler; diff --git a/old/git-webhook-ci/lib/providers/gitlab/index.js b/old/git-webhook-ci/lib/providers/gitlab/index.js deleted file mode 100644 index 174cc2a..0000000 --- a/old/git-webhook-ci/lib/providers/gitlab/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Implement the gitlab methods - */ -const server = require('../lib/server'); -const GitlabWebhook = require('./gitlab-class'); -const debug = require('debug')('git-webhook-ci:gitlab'); - -module.exports = function(config, opt, callback) { - const gitlab = new GitlabWebhook(config); - - // Listen on error - gitlab.on('error', err => { - debug('error', err); - }); - - // Listen on the push event - success - gitlab.on('push', result => { - const ref = result.payload.ref; - if (config.branch === '*' || config.branch === ref) { - callback(result, opt, ref); - } else { - debug('Gitee webhook is not expecting this branch', ref); - } - }); - - return server( - config, - (req, res) => { - gitlab.handler(req, res, function(err) { - res.statusCode = 404; - debug('The url got called! [%s]', req.url, err); - res.end('-- no such location --'); - }); - }, - debug - ); -}; diff --git a/old/git-webhook-ci/lib/providers/index.js b/old/git-webhook-ci/lib/providers/index.js deleted file mode 100644 index badd4af..0000000 --- a/old/git-webhook-ci/lib/providers/index.js +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Return the provider based on the config - */ -const github = require('./github'); -const gitee = require('./gitee'); -const gitlab = require('./gitlab'); -const wechat = require('./wechat'); -/** - * Wrap all the configuration check code here - * Then init the instance and return it - */ -module.exports = provider => { - switch (provider) { - case 'gitee': - return gitee; - case 'gitlab': - return gitlab; - case 'wechat': - return wechat; - default: - return github; - } -}; diff --git a/old/git-webhook-ci/lib/providers/lib/base-tools.js b/old/git-webhook-ci/lib/providers/lib/base-tools.js deleted file mode 100644 index 390bce3..0000000 --- a/old/git-webhook-ci/lib/providers/lib/base-tools.js +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Share the reusable methods here for subclassing - */ -const EventEmitter = require('events'); - -class BaseTools extends EventEmitter { - constructor(options) { - super(); - this.options = options; - } - - /** - * Extract the json payload - * @param {object} req the request Object - * @return {object} Promise - */ - _parsePayload(req) { - return new Promise(resolver => { - let body = []; - req - .on('data', chunk => { - body.push(chunk); - }) - .on('end', () => { - body = Buffer.concat(body).toString(); - // At this point, `body` has the entire request body stored in it as a string - resolver(JSON.parse(body)); - }); - }); - } - - /** - * @param {object} res the respond object - * @param {string} msg to throw - * @return {null} nothing - */ - _resError(res, msg) { - res.writeHead(400, { 'content-type': 'application/json' }); - res.end( - JSON.stringify({ - error: msg - }) - ); - this.emit('error', new Error(msg)); - } -} - -module.exports = BaseTools; diff --git a/old/git-webhook-ci/lib/providers/lib/helpers.js b/old/git-webhook-ci/lib/providers/lib/helpers.js deleted file mode 100644 index 5575aa5..0000000 --- a/old/git-webhook-ci/lib/providers/lib/helpers.js +++ /dev/null @@ -1,6 +0,0 @@ -// Small tools -exports.getTimestamp = () => Date.now(); - -exports.getRandomInt = (min, max) => { - return Math.floor(Math.random() * (max - min + 1)) + min; -}; diff --git a/old/git-webhook-ci/lib/providers/lib/server.js b/old/git-webhook-ci/lib/providers/lib/server.js deleted file mode 100644 index 8bcf29c..0000000 --- a/old/git-webhook-ci/lib/providers/lib/server.js +++ /dev/null @@ -1,10 +0,0 @@ -/** - * Group the server contruction here - */ -const http = require('http'); -// Main export -module.exports = function(config, callback, debug) { - return http.createServer(callback).listen(config.port, () => { - debug(`${config.provider} webhook server start @ ${config.port}`); - }); -}; diff --git a/old/git-webhook-ci/lib/providers/wechat/index.js b/old/git-webhook-ci/lib/providers/wechat/index.js deleted file mode 100644 index d8a0db1..0000000 --- a/old/git-webhook-ci/lib/providers/wechat/index.js +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Construct the interface for Wechat - */ -const WechatHandler = require('./wechat-class'); -const server = require('../lib/server'); -const debug = require('debug')('git-webhook-ci:wechat'); - -module.exports = function(config, opt, callback) { - const wechat = new WechatHandler(config); - - /* This is not implemented, there is no need at the moment - wechat.on('error', err => { - debug('error', err); - }); - */ - wechat.on('push', result => { - callback(result, opt); - }); - - return server( - config, - (req, res) => { - wechat.handler(req, res, function(err) { - res.statusCode = 404; - debug('The url got called! [%s]', req.url, err); - res.end('-- no such location --'); - }); - }, - debug - ); -}; diff --git a/old/git-webhook-ci/lib/providers/wechat/wechat-class.js b/old/git-webhook-ci/lib/providers/wechat/wechat-class.js deleted file mode 100644 index 4d5bbf0..0000000 --- a/old/git-webhook-ci/lib/providers/wechat/wechat-class.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - * This is for wechat mini-app push callback - * Based on their PHP version - */ -/* -https://mp.weixin.qq.com/debug/wxadoc/dev/api/custommsg/callback_help.html - -private function checkSignature() -{ - $signature = $_GET["signature"]; - $timestamp = $_GET["timestamp"]; - $nonce = $_GET["nonce"]; - - $token = TOKEN; - $tmpArr = array($token, $timestamp, $nonce); - sort($tmpArr, SORT_STRING); - $tmpStr = implode( $tmpArr ); - $tmpStr = sha1( $tmpStr ); - - if( $tmpStr == $signature ){ - return true; - }else{ - return false; - } -} -*/ -const BaseTools = require('../lib/base-tools'); -const sha1 = require('sha1'); -const url = require('url'); -const debug = require('debug')('git-webhook-ci:wechat'); -// Main -class WechatHandler extends BaseTools { - constructor(options) { - super(options); - this.options = options; - } - - /** - * Main interface, this is different from the other because there is no filter - * on what is coming, just verify it then pass the payload to the callback - */ - handler(req, res, callback) { - if (this.options.inited !== true) { - const echostr = this._verify(req); - if (!echostr) { - debug('verify with wechat server failed'); - return callback('verify failed'); - } - debug(`verify with wechat echostr '${echostr}' correct`); - res.writeHead(200, { 'content-type': 'text/html' }); - res.end(echostr); - return; - } - // The implementation is different - this._parsePayload(req).then(payload => { - res.writeHead(200, { 'content-type': 'application/json' }); - res.end('{"ok": true}'); - // Just reuse the same naming - this.emit('push', { - payload, - host: req.headers.host, - event: 'wechat-push' - }); - }); - } - - /** - * This is different using the query parameter to compare - * Another thing is - this is a one off verify process - * once the wechat end verify this end is correct, it will - * just send data over. Need to figure out a way to run this - * verify before the actual listening - */ - _verify(req) { - const { query } = url.parse(req.url, true); - const { signature, timestamp, nonce, echostr } = query; - const $token = this.options.secret; - let $tmpArr = [$token, timestamp, nonce]; - $tmpArr.sort(); - return sha1($tmpArr.join('')) === signature ? echostr : false; - } -} -// Export -module.exports = WechatHandler; diff --git a/old/git-webhook-ci/package.json b/old/git-webhook-ci/package.json deleted file mode 100644 index 85c2e1e..0000000 --- a/old/git-webhook-ci/package.json +++ /dev/null @@ -1,102 +0,0 @@ -{ - "name": "git-webhook-ci", - "version": "1.0.0", - "description": "A Git(hub) webhook callback server to fetch new code (poor man CI)", - "homepage": "https://gitlab.com/newbranltd/git-webhook-ci", - "author": { - "name": "Joel Chu", - "email": "joelckchu@gmail.com", - "url": "https://joelchu.com" - }, - "files": [ - "lib", - "index.js", - "cli.js" - ], - "main": "index.js", - "keywords": [ - "gulp", - "node", - "git", - "github", - "gitee", - "gitlab", - "wechat" - ], - "devDependencies": { - "eslint": "^5.1.0", - "eslint-config-prettier": "^2.9.0", - "eslint-config-xo": "^0.23.0", - "eslint-plugin-prettier": "^2.6.2", - "husky": "^0.14.3", - "jest": "^23.4.1", - "lint-staged": "^7.2.0", - "nsp": "^3.2.1", - "prettier": "^1.13.7", - "supertest": "^3.1.0" - }, - "scripts": { - "prepublishOnly": "nsp check", - "pretest": "eslint . --fix", - "precommit": "lint-staged", - "test": "DEBUG=git-webhook-ci:test,git-webhook-ci:demo jest --runInBand --forceExit", - "test:cli": "DEBUG=git-webhook-ci:test,git-webhook-ci:main,git-webhook-ci:gitee jest --forceExit ./__tests__/cli.test.js", - "test:wechat": "DEBUG=git-webhook-ci:test,git-webhook-ci:wechat jest --forceExit ./__tests__/wechat.test.js", - "test-run": "DEBUG=git-webhook-ci:test,git-webhook-ci:demo jest ./__tests__/gitlab.test.js" - }, - "lint-staged": { - "*.js": [ - "eslint --fix", - "git add" - ], - "*.json": [ - "prettier --write", - "git add" - ] - }, - "eslintConfig": { - "extends": [ - "xo", - "prettier" - ], - "env": { - "jest": true, - "node": true - }, - "rules": { - "prettier/prettier": [ - "error", - { - "singleQuote": true, - "printWidth": 90 - } - ] - }, - "plugins": [ - "prettier" - ] - }, - "repository": { - "type": "git", - "url": "git@gitlab.com:newbranltd/gulp-git-webhook.git" - }, - "jest": { - "testEnvironment": "node", - "testPathIgnorePatterns": [ - "/fixtures/" - ] - }, - "license": "MIT", - "dependencies": { - "debug": "^3.1.0", - "github-webhook-handler": "^0.7.1", - "meow": "^5.0.0", - "sha1": "^1.1.1" - }, - "engines": { - "node": ">=7.00" - }, - "bin": { - "git-webhook-ci": "cli.js" - } -} -- Gitee From 7d0854dd20a4661318ede43d2c6ef9421b7684cc Mon Sep 17 00:00:00 2001 From: to1source Date: Thu, 24 Jun 2021 22:03:58 +0800 Subject: [PATCH 2/4] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ea26485..a5df0c3 100644 --- a/README.md +++ b/README.md @@ -83,4 +83,4 @@ We drop the cli support since V.2 due to the large amount of configuration optio ## License -WTFPL - Joel Chu (c) 2021 +WTFPL - TO1SOURCE / Joel Chu (c) 2021 -- Gitee From 69b7a5d83adbcbc3234c8e22b5a0637c5217fd1b Mon Sep 17 00:00:00 2001 From: to1source Date: Thu, 24 Jun 2021 22:06:02 +0800 Subject: [PATCH 3/4] update the branch config in run.ts --- run.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/run.ts b/run.ts index b1830ab..d7952a7 100644 --- a/run.ts +++ b/run.ts @@ -6,6 +6,7 @@ import { gitWebhookCi } from './src/main' const config = { port: 4567, provider: 'github', + branch: '*', secret: process.env.SECRET, // so we only pass this when run it cmd: (args: []): void => { console.log("Got callback") @@ -17,4 +18,4 @@ const config = { } } -gitWebhookCi(config) \ No newline at end of file +gitWebhookCi(config) -- Gitee From c74661de332c4731e3fddae1e356271460320cf8 Mon Sep 17 00:00:00 2001 From: to1source Date: Thu, 24 Jun 2021 22:07:11 +0800 Subject: [PATCH 4/4] update README.en.md --- README.en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.en.md b/README.en.md index ea26485..a5df0c3 100644 --- a/README.en.md +++ b/README.en.md @@ -83,4 +83,4 @@ We drop the cli support since V.2 due to the large amount of configuration optio ## License -WTFPL - Joel Chu (c) 2021 +WTFPL - TO1SOURCE / Joel Chu (c) 2021 -- Gitee