<commit_before>var restify = require('restify');
var irc = require('irc');
var request = require('request');
var util = require('util');
var config = require('./config.json');

var client = new irc.Client(config.irc.server, config.irc.nick, config.irc);
client.addListener('error', console.error);

var server = restify.createServer();

server.use(restify.queryParser());
server.use(restify.bodyParser());

server.post(config.http.path, (req, res, next) => {
	var channel = '#'+(req.query.channel || config.irc.homeChannel);
	if (req.header('X-GitHub-Event')) {
		var event = req.header('X-GitHub-Event');
		var action = req.body.action;
		var repo = req.body.repository ? req.body.repository.full_name : null;
		var org = req.body.organization ? req.body.organization.login : null;
		var sender = req.body.sender.login;
		if (event === 'issues') {
			var issue = req.body.issue;
			if (action === 'opened') {
				msg(channel, repo, 'Issue #'+issue.number+' §a§lopened§r by '+sender, issue.title, issue.html_url);
			} else if (action === 'closed') {
				msg(channel, repo, 'Issue #'+issue.number+' §c§lclosed§r by '+sender, issue.title, issue.html_url);
			} else if (action === 'reopened') {
				msg(channel, repo, 'Issue #'+issue.number+' §e§lreopened§r by '+sender, issue.title, issue.html_url);
			}
		} else if (event === 'pull_request') {
			var pr = req.body.pull_request;
			if (action === 'opened') {
				msg(channel, repo, 'Pull #'+pr.number+' §a§lopened§r by '+sender, pr.title, pr.html_url);
			} else if (action === 'closed') {
				if (req.body.pull_request.merged) {
					msg(channel, repo, 'Pull #'+pr.number+' §d§lmerged§r by '+sender, pr.title, pr.html_url);
				} else {
					msg(channel, repo, 'Pull #'+pr.number+' §c§lclosed§r by '+sender, pr.title, pr.html_url);
				}
			} else if (action === 'reopened') {
				msg(channel, repo, 'Pull #'+pr.number+' §e§lreopened§r by '+sender, pr.title, pr.html_url);
			} else if (action === "review_requested") {
				msg(channel, repo, 'Review on pull request #'+req.body.pull_request.number+' from '+req.body.requested_reviewer.login+' §lrequested§r by '+sender, req.body.pull_request.title, req.body.pull_request.html_url);
			}
		} else if (event === 'push') {
			var branch = req.body.ref.slice(11)+'/';
			if (branch === req.body.repository.default_branch) branch = '';
			req.body.commits.forEach((commit) => {
				msg(channel, repo, 'Commit §a§lpushed§r by '+sender, '§l'+branch+commit.id.slice(0, 8)+'§r '+commit.message.split('\n')[0], commit.url);
			});
		} else if (event === 'repository') {
			if (action === 'created') {
				msg(channel, repo, 'Repository §a§lcreated§r by '+sender, req.body.repository.description, req.body.repository.html_url);
			} else if (action === 'deleted') {
				msg(channel, repo, 'Repository §c§ldeleted§r by '+sender, '', null);
			}
		} else if (event === 'organization') {
			if (action === 'member_added') {
				msg(channel, org, req.body.membership.user.login+' §a§ljoined§r', '', null);
			} else if (action === 'member_removed') {<commit_msg>Only send up to 3 commits individually, otherwise group them<commit_after>var restify = require('restify');
var irc = require('irc');
var request = require('request');
var util = require('util');
var config = require('./config.json');

var client = new irc.Client(config.irc.server, config.irc.nick, config.irc);
client.addListener('error', console.error);

var server = restify.createServer();

server.use(restify.queryParser());
server.use(restify.bodyParser());

server.post(config.http.path, (req, res, next) => {
	var channel = '#'+(req.query.channel || config.irc.homeChannel);
	if (req.header('X-GitHub-Event')) {
		var event = req.header('X-GitHub-Event');
		var action = req.body.action;
		var repo = req.body.repository ? req.body.repository.full_name : null;
		var org = req.body.organization ? req.body.organization.login : null;
		var sender = req.body.sender.login;
		if (event === 'issues') {
			var issue = req.body.issue;
			if (action === 'opened') {
				msg(channel, repo, 'Issue #'+issue.number+' §a§lopened§r by '+sender, issue.title, issue.html_url);
			} else if (action === 'closed') {
				msg(channel, repo, 'Issue #'+issue.number+' §c§lclosed§r by '+sender, issue.title, issue.html_url);
			} else if (action === 'reopened') {
				msg(channel, repo, 'Issue #'+issue.number+' §e§lreopened§r by '+sender, issue.title, issue.html_url);
			}
		} else if (event === 'pull_request') {
			var pr = req.body.pull_request;
			if (action === 'opened') {
				msg(channel, repo, 'Pull #'+pr.number+' §a§lopened§r by '+sender, pr.title, pr.html_url);
			} else if (action === 'closed') {
				if (req.body.pull_request.merged) {
					msg(channel, repo, 'Pull #'+pr.number+' §d§lmerged§r by '+sender, pr.title, pr.html_url);
				} else {
					msg(channel, repo, 'Pull #'+pr.number+' §c§lclosed§r by '+sender, pr.title, pr.html_url);
				}
			} else if (action === 'reopened') {
				msg(channel, repo, 'Pull #'+pr.number+' §e§lreopened§r by '+sender, pr.title, pr.html_url);
			} else if (action === "review_requested") {
				msg(channel, repo, 'Review on pull request #'+req.body.pull_request.number+' from '+req.body.requested_reviewer.login+' §lrequested§r by '+sender, req.body.pull_request.title, req.body.pull_request.html_url);
			}
		} else if (event === 'push') {
			var branch = req.body.ref.slice(11)+'/';
			if (branch === req.body.repository.default_branch) branch = '';
			if (req.body.commits.length <= 3) {
				req.body.commits.forEach((commit) => {
					msg(channel, repo, 'Commit §a§lpushed§r by '+sender, '§l'+branch+commit.id.slice(0, 8)+'§r '+commit.message.split('\n')[0], commit.url);
				});
			} else {
				msg(channel, repo, req.body.commits.length+' commits §a§lpushed§r by '+sender, '§l'+branch+req.body.before.slice(0, 8)+' -> '+branch+req.body.after.slice(0, 8)+'§r', req.body.compare);
			}
		} else if (event === 'repository') {
			if (action === 'created') {
				msg(channel, repo, 'Repository §a§lcreated§r by '+sender, req.body.repository.description, req.body.repository.html_url);
			} else if (action === 'deleted') {
				msg(channel, repo, 'Repository §c§ldeleted§r by '+sender, '', null);
			}
		} else if (event === 'organization') {
			if (action === 'member_added') {
				msg(channel, org, req.body.membership.user.login+' §a§ljoined§r', '', null);
			} else if (action === 'member_removed') {
{'fraction_non_alphanumeric': 0.20056276379552915, 'fraction_numerical': 0.002501172424574019, 'mean_word_length': 4.23996723996724, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 8, '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': '3879766', 'n_tokens_mistral': 2515, 'n_tokens_neox': 2243, 'n_words': 505}