Sha256: 0590fb0cd9cb7369e8dc3543066baebc411c4278894799071c8edc44727cbe66

Contents?: true

Size: 924 Bytes

Versions: 2

Compression:

Stored size: 924 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@#{sha}" }
    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

2 entries across 2 versions & 1 rubygems

Version Path
concourse-github-status-0.5.10 lib/github-status/check.rb
concourse-github-status-0.5.9 lib/github-status/check.rb