Sha256: 6f3e989e9da3983c95bfeddda53bf2d57b9f059078d863d7c0ab2bded0d28b05

Contents?: true

Size: 922 Bytes

Versions: 5

Compression:

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
concourse-github-status-0.5.8 lib/github-status/check.rb
concourse-github-status-0.5.7 lib/github-status/check.rb
concourse-github-status-0.5.0 lib/github-status/check.rb
concourse-github-status-0.4.3 lib/github-status/check.rb
concourse-github-status-0.4.2 lib/github-status/check.rb