From daeb29868ad8ffe8c2185a4f6e4a6b05fa501e19 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Wed, 30 Aug 2017 00:08:16 +0200 Subject: [PATCH] push: filter on branch name; --- config.example.js | 2 ++ index.js | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/config.example.js b/config.example.js index 35f6abc..70138a7 100644 --- a/config.example.js +++ b/config.example.js @@ -10,6 +10,8 @@ module.exports = { projectUrl: "https://framagit.org/bnjbvr/kresus/", + branches: ['master'], + // IRC nick/names for the bot nick: 'gitlab-bot', userName: 'gitlab-bot', diff --git a/index.js b/index.js index c2117e0..346bd9f 100644 --- a/index.js +++ b/index.js @@ -79,6 +79,15 @@ var handlers = { var numCommits = body.total_commits_count; var branchName = body.ref.replace('refs/heads/', ''); + var found = false; + for (var i = 0; i < config.branches.length; i++) { + if (branchName === config.branches[i]) { + found = true; + break; + } + } + if (!found) + return; var msg = null; if (!numCommits) {