lib/danger/ci_source/jenkins.rb in danger-4.2.1 vs lib/danger/ci_source/jenkins.rb in danger-4.2.2
- old
+ new
@@ -60,11 +60,16 @@
def initialize(env)
self.repo_url = self.class.repo_url(env)
self.pull_request_id = self.class.pull_request_id(env)
- repo_matches = self.repo_url.match(%r{([\/:])([^\/]+\/[^\/.]+)(?:.git)?$})
- self.repo_slug = repo_matches[2] unless repo_matches.nil?
+ repo_matches = self.repo_url.match(%r{(?:[\/:])projects\/([^\/.]+)\/repos\/([^\/.]+)}) # Bitbucket Server
+ if repo_matches
+ self.repo_slug = "#{repo_matches[1]}/#{repo_matches[2]}"
+ else
+ repo_matches = self.repo_url.match(%r{([\/:])([^\/]+\/[^\/.]+)(?:.git)?$})
+ self.repo_slug = repo_matches[2] unless repo_matches.nil?
+ end
end
def self.pull_request_id(env)
if env["ghprbPullId"]
env["ghprbPullId"]