Sha256: fbd4ba725ab2e56bceb6cd669a71eaaeac1eda9eea726acb48c5a4c886572c6f

Contents?: true

Size: 928 Bytes

Versions: 4

Compression:

Stored size: 928 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 to_sha(version)
      @sha ||= version.fetch('context@sha') { commit }.split('@').last
    end

    Contract None => 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(to_sha(version)))
        .map { |commit| { 'context@sha' => "concourseci@#{commit[:sha]}" } }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
concourse-github-status-0.4.1 lib/github-status/check.rb
concourse-github-status-0.4.0 lib/github-status/check.rb
concourse-github-status-0.3.1 lib/github-status/check.rb
concourse-github-status-0.3.0 lib/github-status/check.rb