Sha256: 6e0dcfc178f16bc218a3c6b9153903cb117eb4d608f59592115f8c469d63abee

Contents?: true

Size: 735 Bytes

Versions: 1

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

1 entries across 1 versions & 1 rubygems

Version Path
danger-0.8.5 lib/danger/ci_source/semaphore.rb