Sha256: 3bdc3187e00b01034e8c26c1a3f70232752d057db48c49c496c8200326cda209

Contents?: true

Size: 713 Bytes

Versions: 1

Compression:

Stored size: 713 Bytes

Contents

require 'concourse-fuselage'
require 'contracts'
require_relative 'core'
require_relative 'support/github'
require_relative 'support/params'

module GitHubStatus
  class In < Fuselage::In
    include Core
    include Support::Params
    include Support::GitHub

    Contract HashOf[String, String] => String
    def sha(version)
      @sha ||= version.fetch('context@sha') { commit }.split('@').last
    end

    Contract None => Maybe[String]
    def state
      github
        .statuses(repo, sha)
        .select { |status| status.context == context }
        .map(&:state)
        .first
    end

    Contract None => Num
    def fetch!
      File.write "#{workdir}/#{context}.state", state
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
concourse-github-status-0.4.2 lib/github-status/in.rb