Sha256: 4096ffb338e10825b7326c8ffc716ebc2bda3bda66dcaa0a51c0dafc5b3f3494

Contents?: true

Size: 504 Bytes

Versions: 1

Compression:

Stored size: 504 Bytes

Contents

# https://circleci.com/docs/environment-variables
require 'uri'

module Danger
  module CISource
    class CircleCI < CI
      def self.validates?(env)
        return !env["CIRCLE_BUILD_NUM"].nil? && !env["CI_PULL_REQUEST"].nil?
      end

      def initialize(env)
        paths = URI.parse(env["CI_PULL_REQUEST"]).path.split("/")
        # 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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
danger-0.1.1 lib/danger/ci_source/circle.rb