Sha256: 645cc0da0ef09b214d492716be40e40193eb2bf6b4c2b7d67fc925068bab7ed3

Contents?: true

Size: 927 Bytes

Versions: 7

Compression:

Stored size: 927 Bytes

Contents

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

module GitHubStatus
  class Check < Fuselage::Check
    include Core
    include Support::GitHub

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

    Contract String => Time
    def date(sha)
      @date ||= github.commit(repo, sha).commit.author.date
    end

    Contract None => String
    def commit
      @commit ||= github.branch(repo, branch).commit.sha
    end

    Contract None => HashOf[String, String]
    def latest
      { 'context@sha' => "concourseci@#{commit}" }
    end

    Contract HashOf[String, String] => ArrayOf[HashOf[String, String]]
    def since(version)
      github
        .commits_since(repo, date(sha(version)))
        .map { |commit| { 'context@sha' => "concourseci@#{commit[:sha]}" } }
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
concourse-github-status-0.7.1 lib/github-status/check.rb
concourse-github-status-0.7.0 lib/github-status/check.rb
concourse-github-status-0.6.6 lib/github-status/check.rb
concourse-github-status-0.6.4 lib/github-status/check.rb
concourse-github-status-0.6.3 lib/github-status/check.rb
concourse-github-status-0.6.2 lib/github-status/check.rb
concourse-github-status-0.5.11 lib/github-status/check.rb