Sha256: 63831428732bd1dfb9415cc41986b41b9a9d070db75260dc55cff682a5f502ff

Contents?: true

Size: 1.03 KB

Versions: 10

Compression:

Stored size: 1.03 KB

Contents

#!/usr/bin/env ruby
#
# Ad-hoc script for updating a pull request using our service.
#
# Usage:
#
#   $ OAUTH_TOKEN="..." bundle exec ruby pull_request_test.rb
#
#     OAUTH_TOKEN: Personal GitHub access token
#
#         GitHub >
#         Account settings >
#         Applications >
#         Personal access tokens >
#         Generate new token
#
###
require 'cc/services'
CC::Service.load_services

class WithResponseLogging
  def initialize(invocation)
    @invocation = invocation
  end

  def call
    @invocation.call.tap { |r| p r }
  end
end

service = CC::Service::GitHubPullRequests.new({
  oauth_token:   ENV.fetch("OAUTH_TOKEN"),
  update_status: true,
  add_comment:   true,
}, {
  name:        "pull_request",
  # https://github.com/codeclimate/nillson/pull/33
  state:       "success",
  github_slug: "codeclimate/nillson",
  issue_comparison_counts: {"new" => 0, "fixed" => 0},
  number:      33,
  commit_sha:  "986ec903b8420f4e8c8d696d8950f7bd0667ff0c"
})

CC::Service::Invocation.new(service) do |i|
  i.wrap(WithResponseLogging)
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
codeclimate-services-0.6.2 pull_request_test.rb
codeclimate-services-0.6.1 pull_request_test.rb
codeclimate-services-0.6.0 pull_request_test.rb
codeclimate-services-0.5.3 pull_request_test.rb
codeclimate-services-0.5.2 pull_request_test.rb
codeclimate-services-0.5.1 pull_request_test.rb
codeclimate-services-0.5.0 pull_request_test.rb
codeclimate-services-0.4.1 pull_request_test.rb
codeclimate-services-0.4.0 pull_request_test.rb
codeclimate-services-0.3.0 pull_request_test.rb