rok commented on code in PR #33791:
URL: https://github.com/apache/arrow/pull/33791#discussion_r1083554966


##########
dev/release/02-source-test.rb:
##########
@@ -93,33 +93,26 @@ def test_python_version
   end
 
   def test_vote
-    jira_url = "https://issues.apache.org/jira";
-    jql_conditions = [
-      "project = ARROW",
-      "status in (Resolved, Closed)",
-      "fixVersion = #{@release_version}",
-    ]
-    jql = jql_conditions.join(" AND ")
+    github_token = ENV["ARROW_GITHUB_API_TOKEN"]
+    uri = URI.parse("https://api.github.com/graphql";)
+    https = Net::HTTP.new(uri.host, uri.port)
+    https.use_ssl = true
+    req = Net::HTTP::Post.new(uri.path, initheader = {"Authorization" => 
"Bearer #{github_token}"})
+
+    n_issues_query = "{\"query\":\"query {search(query: \\\"repo:apache/arrow 
is:issue is:closed milestone:#{@release_version}\\\", type:ISSUE) 
{issueCount}}\"}"
+    req.body = n_issues_query
     n_resolved_issues = nil
-    search_url = URI("#{jira_url}/rest/api/2/search?jql=#{CGI.escape(jql)}")
-    search_url.open do |response|
-      n_resolved_issues = JSON.parse(response.read)["total"]
+    https.request(req) do |response|
+        n_resolved_issues = 
JSON.parse(response.body)["data"]["search"]["issueCount"]
     end
-    github_api_url = "https://api.github.com";
-    verify_prs = URI("#{github_api_url}/repos/apache/arrow/pulls" +
-                     "?state=open" +
-                     "&head=apache:release-#{@release_version}-rc0")
+
+    pr_query = "{\"query\": \"query {repository(owner: \\\"apache\\\", name: 
\\\"arrow\\\") {refs(first: 1, refPrefix: \\\"refs/heads/\\\", query: 
\\\"release-#{@release_version}-rc0\\\") {nodes{associatedPullRequests(first: 
1){edges{node{url}}}}}}}\"}"
+    req.body = pr_query
     verify_pr_url = nil
-    headers = {
-      "Accept" => "application/vnd.github+json",
-    }
-    github_token = ENV["ARROW_GITHUB_API_TOKEN"]
-    if github_token
-      headers["Authorization"] = "Bearer #{github_token}"
-    end
-    verify_prs.open(headers) do |response|
-      verify_pr_url = (JSON.parse(response.read)[0] || {})["html_url"]
+    https.request(req) do |response|
+      verify_pr_url = 
JSON.parse(response.body)["data"]["repository"]["refs"]["nodes"][0]["associatedPullRequests"]["edges"][0]["node"]["url"]
     end
+

Review Comment:
   I proposed the change to use a single API endpoint, it's not that important 
I suppose. Reverting.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to