lib/danger/ci_source/circle.rb in danger-0.1.1 vs lib/danger/ci_source/circle.rb in danger-0.2.0
- old
+ new
@@ -3,15 +3,17 @@
module Danger
module CISource
class CircleCI < CI
def self.validates?(env)
- return !env["CIRCLE_BUILD_NUM"].nil? && !env["CI_PULL_REQUEST"].nil?
+ return !env["CIRCLE_BUILD_NUM"].nil? &&
+ !env["CI_PULL_REQUEST"].nil? &&
+ URI.parse(env["CI_PULL_REQUEST"]).path.split("/").count == 5
end
def initialize(env)
paths = URI.parse(env["CI_PULL_REQUEST"]).path.split("/")
- # the first one is an extra slash, ignore it
+ # The first one is an extra slash, ignore it
self.repo_slug = paths[1] + "/" + paths[2]
self.pull_request_id = paths[4]
end
end
end