Sha256: 36bc3d6b65bb344d728d81ce5b2beba74fe918fe3cf8558b36c892d345759945

Contents?: true

Size: 765 Bytes

Versions: 4

Compression:

Stored size: 765 Bytes

Contents

# https://semaphoreci.com/docs/available-environment-variables.html

module Danger
  module CISource
    # https://semaphoreci.com
    class Semaphore < CI
      def self.validates?(env)
        return false unless env["SEMAPHORE"]
        return false unless env["SEMAPHORE_REPO_SLUG"]
        return false unless env["PULL_REQUEST_NUMBER"].to_i > 0

        return true
      end

      def supported_request_sources
        @supported_request_sources ||= [Danger::RequestSources::GitHub]
      end

      def initialize(env)
        self.repo_slug = env["SEMAPHORE_REPO_SLUG"]
        self.pull_request_id = env["PULL_REQUEST_NUMBER"]
        self.repo_url = GitRepo.new.origins # Semaphore doesn't provide a repo url env variable :/
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
danger-2.0.1 lib/danger/ci_source/semaphore.rb
danger-2.0.0 lib/danger/ci_source/semaphore.rb
danger-0.10.1 lib/danger/ci_source/semaphore.rb
danger-0.10.0 lib/danger/ci_source/semaphore.rb