Sha256: ea9669909dfc55852b3b2ebe0e800f55c6548b19e85de9e22ceb4654f12f184c

Contents?: true

Size: 735 Bytes

Versions: 5

Compression:

Stored size: 735 Bytes

Contents

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

module Danger
  module CISource
    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

5 entries across 5 versions & 1 rubygems

Version Path
danger-0.9.1 lib/danger/ci_source/semaphore.rb
danger-0.9.0 lib/danger/ci_source/semaphore.rb
danger-0.8.4 lib/danger/ci_source/semaphore.rb
danger-0.8.3 lib/danger/ci_source/semaphore.rb
danger-0.8.2 lib/danger/ci_source/semaphore.rb