1
0
mirror of https://gitlab.com/ceda_ei/git-alerts-bot synced 2025-07-11 22:46:54 +02:00

19 lines
552 B
JavaScript

const github = function (data) {
const noun = "commit" + data.commits.length > 1?"s":"";
var text = data.commits.reduce((acc, curr, index) => {
if (index < 6) {
acc += `<a href='${curr.url}'>${curr.id.slice(0,6)}: ` +
`${curr.message}</a>\n`;
}
return acc;
}, `🔨 ${data.commits.length} ${noun}\n`);
if (data.commits.length > 6) {
text += `${data.commits.length - 6} more ${noun}.`;
}
return text;
};
const gitlab = github;
module.exports = { github, gitlab };