marcells / node-build-monitor

A Build Monitor written in Node.js, which supports several build services and can be easily extended.
https://marcells.github.io/node-build-monitor
MIT License
349 stars 168 forks source link

Potential bug - droneCI filtering by branch and event #213

Closed nkringle closed 4 years ago

nkringle commented 4 years ago

I think this is a bug in the DroneCI filter logic. Here's what I'm trying to do:

I have a drone service that is specing both a branch and an event:

{
        "name": "Drone",
        "configuration": {
            "url": "${DRONE_URL}",
            "token": "${DRONE_TOKEN}",
            "branch": "master",
            "event": "push",
            "slug": 'repoSlug'
        }
}

Pushes to non-master branches still trigger the build status to change.

This changes seems to resolve the issue:

function(build) {
      var matchesBranch, matchesEvent = true;

      if (self.configuration.branch) {
        matchesBranch = build.target === self.configuration.branch;
      }

      if (self.configuration.event) {
        matchesEvent = build.event === self.configuration.event;
      }
      return matchesBranch && matchesEvent;
 }