<commit_before>'use strict'
const http = require('http');
const child_process = require('child_process');

http.createServer(function (req, res) {
	let result = 'success';
	if(req.url === '/hook' && req.method === 'POST'){ 
		let arr = [];
	    req.on("data",function(data){
	        arr.push(data);
	    });
	    req.on("end",function(){
	        let data= Buffer.concat(arr).toString();
	        let ret = {};
	        try{
	            ret = JSON.parse(data);
	        }catch(err){
	        	console.log('JSON parse error, data: ' + data);
	        }

	        // 当提交的分支是develop时触发脚本
	        if(ret.ref === 'refs/heads/develop') {
	        	console.log('%s auto deploy', new Date().toLocaleString());
	        	let options = {
					encoding: 'utf8',
				  	timeout:60000
				};
				child_process.exec('sh ' + __dirname + '/hook.sh', options, function (err, stdout, stderr) {
				    console.log(err || stdout || stderr);
				});
	        } else {<commit_msg>修改查看日志的方式<commit_after>'use strict'
const http = require('http');
const child_process = require('child_process');

http.createServer(function (req, res) {
	let result = 'success';
	if(req.url === '/hook' && req.method === 'POST'){ 
		let arr = [];
	    req.on("data",function(data){
	        arr.push(data);
	    });
	    req.on("end",function(){
	        let data= Buffer.concat(arr).toString();
	        let ret = {};
	        try{
	            ret = JSON.parse(data);
	        }catch(err){
	        	console.log('JSON parse error, data: ' + data);
	        }

	        // 当提交的分支是develop时触发脚本
	        if(ret.ref === 'refs/heads/develop') {
	        	console.log('%s auto deploy', new Date().toLocaleString());
	        	let options = {
					encoding: 'utf8',
				  	timeout:600000
				};
				child_process.exec('sh ' + __dirname + '/hook.sh >> hook.log', options, function (err, stdout, stderr) {
				    console.log(err || stdout || stderr);
				});
	        } else {
{'fraction_non_alphanumeric': 0.17640972581479566, 'fraction_numerical': 0.006725297465080186, 'mean_word_length': 2.2891156462585034, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1572754', 'n_tokens_mistral': 708, 'n_tokens_neox': 624, 'n_words': 125}