From c6f9ceca44b8794febb129b0a5ca04829d645a25 Mon Sep 17 00:00:00 2001 From: Sarangan Rajamanickam Date: Wed, 31 Oct 2018 00:18:07 -0700 Subject: [PATCH] Code changes for updating Drop comment in PR (#1837) --- Gemfile | 1 + scripts/pr_build_drop_publisher.rb | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 scripts/pr_build_drop_publisher.rb diff --git a/Gemfile b/Gemfile index 8b308f555..83c34532c 100644 --- a/Gemfile +++ b/Gemfile @@ -12,6 +12,7 @@ group :development, :test do gem 'vcr' end +gem 'octokit', '~> 4.0' gem 'azure_mgmt_analysis_services', path: 'management/azure_mgmt_analysis_services' gem 'azure_mgmt_api_management', path: 'management/azure_mgmt_api_management' gem 'azure_mgmt_authorization', path: 'management/azure_mgmt_authorization' diff --git a/scripts/pr_build_drop_publisher.rb b/scripts/pr_build_drop_publisher.rb new file mode 100644 index 000000000..df5f3fb05 --- /dev/null +++ b/scripts/pr_build_drop_publisher.rb @@ -0,0 +1,24 @@ +# encoding: utf-8 +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. + +require 'octokit' + +github_access_token = ARGV[0] +pull_request_number = ARGV[1] +build_number = ARGV[2] + +comment_body = " +# Ruby Build Drop - Direct download +The Gem file (zipped version) could be downloaded [here](https://azuresdkci.westus2.cloudapp.azure.com/job/RubylangSDK_BuildDrop/#{build_number}/Azure/processDownloadRequest/azure-sdk-for-ruby/pullrequests/#{pull_request_number}/azure-sdk-for-ruby_pr#{pull_request_number}.tar.gz). +" + +gh_client = Octokit::Client.new( + :access_token => github_access_token +) + +gh_client.add_comment( + "Azure/azure-sdk-for-ruby", + pull_request_number, + comment_body +)